Darren Dale ha scritto:
I noticed the following error when in my application I try to export the
plot in EPS format. The odd thing is that the export actually works and
produces a good eps file, but nevertheless...

File "hooke.py", line 354, in ExportImage #that's my wxpython+MPL app
     self.figure.savefig(filename)
   File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line
660, in savefig
     self.canvas.print_figure(*args, **kwargs)
   File
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py",
line 1123, in print_figure
     else: shutil.move(tmpfile, outfile)
   File "/usr/lib/python2.4/shutil.py", line 193, in move
     copy2(src,dst)
   File "/usr/lib/python2.4/shutil.py", line 93, in copy2
     copystat(src, dst)
   File "/usr/lib/python2.4/shutil.py", line 68, in copystat
     os.utime(dst, (st.st_atime, st.st_mtime))
OSError: [Errno 1] Operation not permitted: 'figura001.eps'

please submit a short script that reproduces the problem.

I have just reproduced it by doing an histogram in an interactive ipython --pylab session and then exporting as 'figure.eps'.

Just:
a=[...] <--numbers to histogram
hist(a)
savefig('hist001.eps')

gives:

exceptions.OSError Traceback (most recent call last)

/users/Massimo/synuclein/<ipython console>

/usr/lib/python2.4/site-packages/matplotlib/pylab.py in savefig(*args, **kwargs)
    809 def savefig(*args, **kwargs):
    810     fig = gcf()
--> 811     return fig.savefig(*args, **kwargs)
    812 if Figure.savefig.__doc__ is not None:
    813     savefig.__doc__ = _shift_string(Figure.savefig.__doc__)

/usr/lib/python2.4/site-packages/matplotlib/figure.py in savefig(self, *args, **kwargs)
    658                 kwargs[key] = rcParams['savefig.%s'%key]
    659
--> 660         self.canvas.print_figure(*args, **kwargs)
    661
    662     def colorbar(self, mappable, cax=None, **kw):

/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, **kwargs)
    110             try:
111 agg.print_figure(filename, dpi, facecolor, edgecolor,
--> 112                                  orientation, **kwargs)
    113             except IOError, msg:
114 error_msg_gtk('Failed to save\nError message: %s'%(msg,), self)

/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, **kwargs)
    482                 ps = self.switch_backends(FigureCanvasPS)
483 ps.print_figure(filename, dpi, facecolor, edgecolor,
--> 484                                 orientation, **kwargs)
    485             else:
486 raise IOError('Do not know know to handle extension *%s' % ext)

/usr/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py in print_figure(self, outfile, dpi, facecolor, edgecolor, orientation, papertype)
   1121                 fh = file(tmpfile)
   1122                 print >>outfile, fh.read()
-> 1123             else: shutil.move(tmpfile, outfile)
   1124
1125 def _print_figure_tex(self, outfile, dpi, facecolor, edgecolor, orientation,

/usr/lib/python2.4/shutil.py in move(src, dst)
    191             rmtree(src)
    192         else:
--> 193             copy2(src,dst)
    194             os.unlink(src)
    195

/usr/lib/python2.4/shutil.py in copy2(src, dst)
     91         dst = os.path.join(dst, os.path.basename(src))
     92     copyfile(src, dst)
---> 93     copystat(src, dst)
     94
     95

/usr/lib/python2.4/shutil.py in copystat(src, dst)
     66     mode = stat.S_IMODE(st.st_mode)
     67     if hasattr(os, 'utime'):
---> 68         os.utime(dst, (st.st_atime, st.st_mtime))
     69     if hasattr(os, 'chmod'):
     70         os.chmod(dst, mode)

OSError: [Errno 1] Operation not permitted: 'hist001.eps'

MPL is 0.87.3 compiled from source on gnu/linux Kubuntu 6.06
Thanks,
m.

--
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"

snail mail:
Via Irnerio 48, 40126 Bologna, Italy

email:
[EMAIL PROTECTED]

tel: +39-051-2094388
fax: +39-051-2094387
begin:vcard
fn:Massimo Sandal
n:Sandal;Massimo
org:University of Bologna;Department of Biochemistry
adr:;;Via Irnerio 48;Bologna;;40126;Italy
email;internet:[EMAIL PROTECTED]
tel;work:+39-051-2094388
tel;fax:+39-051-2094387
x-mozilla-html:FALSE
version:2.1
end:vcard

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to