Group,
This error occurs for me with Matplotlib 0.99.1, Python 2.5.4 and 2.6.2, while
using the Qt4Agg backend on Windows XP.
Basically, savefig('aweomse_plot.pdf') barfs if I have some math text in there.
For example:
--------------------------------------------------
|C:\Documents and Settings\phobson>ipython26 -pylab
|Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]
|Type "copyright", "credits" or "license" for more information.
|
|IPython 0.10 -- An enhanced Interactive Python.
|? -> Introduction and overview of IPython's features.
|%quickref -> Quick reference.
|help -> Python's own help system.
|object? -> Details about 'object'. ?object also works, ?? prints more
|
| Welcome to pylab, a matplotlib-based Python environment.
| For more information, type 'help(pylab)'.In [1]: x = arange(10)
|
|In [2]: y = 0.5*x**2
|
|In [3]: plot(x,y,'ko')
|Out[3]: [<matplotlib.lines.Line2D object at 0x039F3C10>]
|
|In [4]: savefig('test.png')
|
|In [5]: savefig('test.pdf')
|
|In [6]: xlabel('rSome math: $X$')
|Out[6]: <matplotlib.text.Text object at 0x03A7A350>
|
|In [7]: savefig('test.pdf')
--------------------------------------------------
Spits out a nasty error at Input Line 7. I've include it below my sig for those
who might want to look at it.
I don't know much about back ends, but I feel like I've neglected to install
something since the last line of the TraceBack includes "ValueError: unichr()
arg not in range(0x10000) (narrow Python build)".
I have an update-version of MikTeX on this machine. Any thoughts?
Many thanks,
Paul M. Hobson
Senior Staff Engineer
--
Geosyntec Consultants
55 SW Yamhill St, Ste 200
Portland, OR 97204
Phone: (503) 222-9518
Web: www.geosyntec.com
Erros message:
########################################################
In [7]: savefig('test.pdf')
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
C:\Documents and Settings\phobson\<ipython console> in <module>()
C:\Python26\lib\site-packages\matplotlib\pyplot.pyc in savefig(*args, **kwargs)
354 def savefig(*args, **kwargs):
355 fig = gcf()
--> 356 return fig.savefig(*args, **kwargs)
357 if Figure.savefig.__doc__ is not None:
358 savefig.__doc__ = dedent(Figure.savefig.__doc__)
C:\Python26\lib\site-packages\matplotlib\figure.pyc in savefig(self, *args,
**kwargs)
1030 patch.set_alpha(0.0)
1031
-> 1032 self.canvas.print_figure(*args, **kwargs)
1033
1034 if transparent:
C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.pyc in
print_figure(self, *args, **kwargs)
141 self.update(l, self.renderer.height-t, w, h)
142
143 def print_figure(self, *args, **kwargs):
--> 144 FigureCanvasAgg.print_figure(self, *args, **kwargs)
145 self.draw()
C:\Python26\lib\site-packages\matplotlib\backend_bases.pyc in
print_figure(self, filename, dpi, facecolor, edgecolor, orientation
format, **kwargs)
1474 orientation=orientation,
1475 bbox_inches_restore=_bbox_inches_restore,
-> 1476 **kwargs)
1477 finally:
1478 if bbox_inches and restore_bbox:
C:\Python26\lib\site-packages\matplotlib\backend_bases.pyc in print_pdf(self,
*args, **kwargs)
1332 from backends.backend_pdf import FigureCanvasPdf # lazy import
1333 pdf = self.switch_backends(FigureCanvasPdf)
-> 1334 return pdf.print_pdf(*args, **kwargs)
1335
1336 def print_png(self, *args, **kwargs):
C:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.pyc in
print_pdf(self, filename, **kwargs)
2023 width, height, image_dpi, RendererPdf(file, image_dpi),
2024 bbox_inches_restore=_bbox_inches_restore)
-> 2025 self.figure.draw(renderer)
2026 renderer.finalize()
2027 if isinstance(filename, PdfPages): # finish off this page
C:\Python26\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist,
renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48
C:\Python26\lib\site-packages\matplotlib\figure.pyc in draw(self, renderer)
771
772 # render the axes
--> 773 for a in self.axes: a.draw(renderer)
774
775 # render the figure text
C:\Python26\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist,
renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48
C:\Python26\lib\site-packages\matplotlib\axes.pyc in draw(self, renderer,
inframe)
1733
1734 for zorder, i, a in dsu:
-> 1735 a.draw(renderer)
1736
1737 renderer.close_group('axes')
C:\Python26\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist,
renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48
C:\Python26\lib\site-packages\matplotlib\axis.pyc in draw(self, renderer,
*args, **kwargs)
755 self._update_label_position(ticklabelBoxes, ticklabelBoxes2)
756
--> 757 self.label.draw(renderer)
758
759 self._update_offset_text_position(ticklabelBoxes,
ticklabelBoxes2)
C:\Python26\lib\site-packages\matplotlib\text.pyc in draw(self, renderer)
563 renderer.draw_text(gc, x, y, clean_line,
564 self._fontproperties, angle,
--> 565 ismath=ismath)
566
567 gc.restore()
C:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.pyc in
draw_text(self, gc, x, y, s, prop, angle, ismath)
1514
1515 self.check_gc(gc, gc._rgb)
-> 1516 if ismath: return self.draw_mathtext(gc, x, y, s, prop, angle)
1517
1518 fontsize = prop.get_size_in_points()
C:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.pyc in
draw_mathtext(self, gc, x, y, s, prop, angle)
1376 Op.selectfont)
1377 prev_font = fontname, fontsize
-> 1378 self.file.output(self.encode_string(unichr(num),
fonttype), Op.show)
1379 self.file.output(Op.end_text)
1380
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users