Hello,
> Slight problem: it might now be a little bit more
> difficult to include the name of the file which could not
> be opened in the error message. The IOError exception
> will probably only have "permission denied" associated
> with it.
Looks OK, at least on linux
>>> file('/sbin/ldconfig', 'w')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
IOError: [Errno 13] Permission denied: '/sbin/ldconfig'
But sometimes it doesn't give the file name:
>>> from matplotlib.matlab import *
>>> plot([1,2,3],[2,3,1])
[<matplotlib.lines.Line2D instance at 0x41ef774c>]
>>> savefig("/forbidden.png")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File ".../matlab.py", line 1009, in savefig
manager.canvas.print_figure(*args, **kwargs)
File ".../backends/backend_gtkagg.py", line 69, in print_figure
agg.print_figure(filename, dpi, facecolor, edgecolor, orientation)
File ".../backends/backend_agg.py", line 379, in print_figure
self.renderer._renderer.write_png(str(filename))
RuntimeError: could not open file
I did not investigate what happens here, but if there is an easy way to
get the file name into the exception we should probably use it.
All the best,
Jochen
···
On Fri, Nov 19, 2004 at 10:33:43AM -0600, John Hunter wrote:
--