Matplotlib IOError: Error While Writing to Output Stream

(0 votes, average 0 out of 5)

When using the Python Matplotlib library, Python may throw the following error:

1
IOError: error while writing to output stream

Commonly this is caused because Python does not have access to the output stream -- in this case, usually some file that Matplotlib is attempting to write to.  This is typical when the Python script is being used on a web server.  For instance, the following code might not work if the directory "output" does not have write permissions on a server:

1
2
3
plt.figure()
plt.plot(x, y)
plt.savefig(output/example.pdf)

How to set permissions will vary depending on the file system used on your web server.  Contact the administrator of your server if you are not able to modify permissions yourself, or are unsure how to modify permissions.

Partner Links:
Last Updated on Monday, 19 July 2010 14:30  
Related Articles

» Oracle 9.2.0 Error: System.Data.OracleClient requires Oracle client software version 8.1.7

ProblemWhen using a version of Oracle 9.2.0 in ASP.NET, attempting to access a site which uses System.Data.OracleClient may give an error with the following exception:  System.Data.OracleClient requires Oracle client software version 8.1.7 or greater This is a common error when using ASP.NET with Oracle -- it is in fact a bug in the default Oracle 9.2.0 installation permissions.  To fix the error, follow the following solution steps (taken from cited source): Log on to...

» How to install Adobe Photoshop CS5 In Ubuntu Linux using WINE

These instructions were tested with Adobe Photoshop CS5.1 (the 30-day trial from Adobe's website) under Ubuntu 11.10 using WINE 1.4-rc5. I was not able to get the installer to work, however the method of installing on Windows and then copying over did work (see ). The directories I copied were:C:\Program Files\Adobe\ C:\Program Files\Common Files\Adobe C:\Program Files (x86)\Adobe C:\Program Files (x86)\Common Files\Adobe C:\Users\All Users\Application Data\Adobe\CS5Note: you must copy each...

» How to Undo a File Move, Copy, or Delete with a Hotkey

As long as you have not permanently deleted a file by emptying the recycling bin or deleting the file with shift + delete, you can easily undo a file move, copy, or deletion using the control + z hotkey.