|
From: Jochen V. <vo...@se...> - 2004-11-24 12:07:05
|
Hello,
On Fri, Nov 19, 2004 at 10:33:43AM -0600, John Hunter wrote:
> >>>>> "Jochen" =3D=3D Jochen Voss <vo...@se...> writes:
> Jochen> Slight problem: it might now be a little bit more
> Jochen> difficult to include the name of the file which could not
> Jochen> be opened in the error message. The IOError exception
> Jochen> will probably only have "permission denied" associated
> Jochen> with it.
>=20
> Looks OK, at least on linux
>=20
>=20
> >>> 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
--=20
http://seehuhn.de/
|