My guess is that somehow the output format of bbox device in the recent ghostscript has changed.
What kind of output do you get when you run > gs -dBATCH -dNOPAUSE -sDEVICE=bbox test.eps in your shell (replace "test.eps" with any eps file you have) I get GPL Ghostscript 8.61 (2007-11-21) Copyright (C) 2007 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. %%BoundingBox: 71 214 541 578 %%HiResBoundingBox: 71.207998 214.811993 540.629984 577.169982 The last two lines are what matplotlib requires to work. Meanwhile, can you test if following changes make things work? In lib/matplotlib/backends/backend_ps.py, comment out following two lines near the end of the function "xpdf_distill" (around line 1458 in my code), i.e., if eps: pstoeps(tmpfile, bbox) It will not raise the error, but may give you a wrong bbox. Regards, -JJ On Mon, Jan 11, 2010 at 3:11 PM, John Reid <j.r...@mail.cryst.bbk.ac.uk> wrote: > Thanks for looking at this. I upgraded to 99.1.1 (although the tar file > was named 99.1.2) and I got the same error message. When I played with > the ps.usedistiller option I found it only doesn't work when I set > ps.usedistiller to xpdf. With False or ghostscript it works ok but gives > me output with different page sizes. AFAIK xpdf is the way to go for > publication quality graphics. Do you know how I can get it to work? Is > it worth trying the svn version? > > Thanks, > John. > > > > Jae-Joon Lee wrote: >> You code works okay with the current svn. >> >> See if changing the distiller option makes any difference >> ("ps.usedistiller" in the rc file). >> >> The best would be for you to upgrade to the recent release of >> matplotlib if possible. >> >> Regards, >> >> -JJ >> >> >> On Mon, Jan 11, 2010 at 8:35 AM, John Reid <j.r...@mail.cryst.bbk.ac.uk> >> wrote: >>> Hi, >>> >>> I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The >>> following code produces the following error. Can anyone verify whether >>> this a problem with my installation or with matplotlib? >>> >>> import pylab as P >>> P.figure() >>> width=.4 >>> x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6] >>> y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146, >>> 0.4043846450263317, 0.28361561411668612, 1.0] >>> x2 = [0, 1, 2, 3, 4, 5, 6] >>> y2 = [1.0, 0.97032301818547173, 0.77110383361936519, >>> 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0] >>> P.bar(x1, y1, color='blue' , width=width, label='nodes') >>> P.bar(x2, y2, color='green', width=width, label='occurrences') >>> P.savefig('fraction-evaluated.eps') >>> P.close() >>> >>> >>> >>> >>> /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>() >>> 246 P.bar(x1, y1, color='blue' , width=width, label='nodes') >>> 247 P.bar(x2, y2, color='green', width=width, label='occurrences') >>> --> 248 P.savefig('fraction-evaluated.eps') >>> 249 P.close() >>> 250 raise >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc >>> in savefig(*args, **kwargs) >>> 343 def savefig(*args, **kwargs): >>> 344 fig = gcf() >>> --> 345 return fig.savefig(*args, **kwargs) >>> 346 if Figure.savefig.__doc__ is not None: >>> 347 savefig.__doc__ = dedent(Figure.savefig.__doc__) >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc >>> in savefig(self, *args, **kwargs) >>> 988 patch.set_alpha(0.0) >>> 989 >>> --> 990 self.canvas.print_figure(*args, **kwargs) >>> 991 >>> 992 if transparent: >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc >>> in print_figure(self, filename, *args, **kwargs) >>> 99 def print_figure(self, filename, *args, **kwargs): >>> 100 # Use pure Agg renderer to draw >>> --> 101 FigureCanvasAgg.print_figure(self, filename, *args, >>> **kwargs) >>> 102 # Restore the current view; this is needed because the >>> 103 # artist contains methods rely on particular attributes >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc >>> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, >>> format, **kwargs) >>> 1417 edgecolor=edgecolor, >>> 1418 orientation=orientation, >>> -> 1419 **kwargs) >>> 1420 finally: >>> 1421 self.figure.dpi = origDPI >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc >>> in print_eps(self, *args, **kwargs) >>> 1306 from backends.backend_ps import FigureCanvasPS # lazy >>> import >>> 1307 ps = self.switch_backends(FigureCanvasPS) >>> -> 1308 return ps.print_eps(*args, **kwargs) >>> 1309 >>> 1310 def print_pdf(self, *args, **kwargs): >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in print_eps(self, outfile, *args, **kwargs) >>> 867 >>> 868 def print_eps(self, outfile, *args, **kwargs): >>> --> 869 return self._print_ps(outfile, 'eps', *args, **kwargs) >>> 870 >>> 871 def _print_ps(self, outfile, format, *args, **kwargs): >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in _print_ps(self, outfile, format, *args, **kwargs) >>> 893 else: >>> 894 self._print_figure(outfile, format, imagedpi, >>> facecolor, edgecolor, >>> --> 895 orientation, isLandscape, papertype) >>> 896 >>> 897 def _print_figure(self, outfile, format, dpi=72, >>> facecolor='w', edgecolor='w', >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, >>> orientation, isLandscape, papertype) >>> 1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) >>> 1037 elif rcParams['ps.usedistiller'] == 'xpdf': >>> -> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype, >>> bbox=bbox) >>> 1039 >>> 1040 if passed_in_file_object: >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in xpdf_distill(tmpfile, eps, ptype, bbox) >>> 1311 shutil.move(psfile, tmpfile) >>> 1312 if eps: >>> -> 1313 pstoeps(tmpfile, bbox) >>> 1314 for fname in glob.glob(tmpfile+'.*'): >>> 1315 os.remove(fname) >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in pstoeps(tmpfile, bbox) >>> 1362 Convert the postscript to encapsulated postscript. >>> 1363 """ >>> -> 1364 bbox_info = get_bbox(tmpfile, bbox) >>> 1365 >>> 1366 epsfile = tmpfile + '.eps' >>> >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc >>> in get_bbox(tmpfile, bbox) >>> 1336 else: >>> 1337 raise RuntimeError('Ghostscript was not able to extract >>> a bounding box.\ >>> -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) >>> 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] >>> 1340 >>> >>> RuntimeError: Ghostscript was not able to extract a bounding box.Here is >>> the Ghostscript output: >>> >>> GPL Ghostscript 8.70: Unrecoverable error, exit code 1 >>> >>> > >>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox() >>> 1337 raise RuntimeError('Ghostscript was not able to extract >>> a bounding box.\ >>> -> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info) >>> 1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]] >>> >>> >>> ------------------------------------------------------------------------------ >>> This SF.Net email is sponsored by the Verizon Developer Community >>> Take advantage of Verizon's best-in-class app development support >>> A streamlined, 14 day to market process makes app distribution fast and easy >>> Join now and get one step closer to millions of Verizon customers >>> http://p.sf.net/sfu/verizon-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users