Jouni,
I found the error! I got bored this past weekend and changed my
mathtext.fontset to 'stixsans' just to see hopw it would look -- and then
forgot about it. Changing that value back to 'cm' let's my original code and
pyTest.py run without errors.
I really appreciate your help with this and all of the other insight I've
gained from the regular contributers to this list.
Many thanks,
-paul
Regardless, here's my command line output with stixsans as my mathtext.fontset:
C:\Python25>python -i c:\gdag2009\python\pyTest.py -d pdf
Traceback (most recent call last):
File "c:\gdag2009\python\pyTest.py", line 12, in <module>
pl.savefig('some_math.pdf')
File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 356, in
savefig
return fig.savefig(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 1032, in
savefig
self.canvas.print_figure(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_qt4agg.py",
line 144, in print_figure
FigureCanvasAgg.print_figure(self, *args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py", line 1476,
in print_figure
**kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py", line 1334,
in print_pdf
return pdf.print_pdf(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line
2025, in print_pdf
self.figure.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 46, in
draw_wrapper
draw(artist, renderer, *kl)
File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 773, in draw
for a in self.axes: a.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 46, in
draw_wrapper
draw(artist, renderer, *kl)
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1735, in draw
a.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 46, in
draw_wrapper
draw(artist, renderer, *kl)
File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 757, in draw
self.label.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 565, in draw
ismath=ismath)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line
1516, in draw_text
if ismath: return self.draw_mathtext(gc, x, y, s, prop, angle)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line
1378, in draw_mathtext
self.file.output(self.encode_string(unichr(num), fonttype), Op.show)
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
>>> from pdb import pm
>>> pm()
> c:\python25\lib\site-packages\matplotlib\backends\backend_pdf.py(1378)draw_mathtext()
-> self.file.output(self.encode_string(unichr(num), fonttype), Op.show)
(Pdb) p fontname, fontsize, num, symbol_name
('C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXGeneralItalic.ttf',
7.0, 120378, 'u1D63A')
(Pdb) p s, width, height, descent, glyphs, rects, used_characters
('some math: $\\tau_{y}$', 72.0, 11.0, 3.0, [(0.0, 3.40625,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\V
era.ttf', 10.0, 115, 's'), (5.2099609375, 3.40625,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
10.0, 111, 'o'), (11.328125, 3.40625,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
10.0, 109,
'm'), (21.0693359375, 3.40625,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
10.0, 101, 'e'), (2
7.2216796875, 3.40625,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
10.0, 32, 'space'), (30.400
390625, 3.40625,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
10.0, 109, 'm'), (40.1416015625,
3.40625,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
10.0, 97, 'a'), (46.26953125, 3.40625, 'C
:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
10.0, 116, 't'), (50.1904296875, 3.40625, 'C:\\Pytho
n25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0,
104, 'h'), (56.5283203125, 3.40625, 'C:\\Python25\\lib
\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 58,
'colon'), (59.8974609375, 3.40625, 'C:\\Python25\\lib\\sit
e-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 32, 'space'),
(63.076171875, 3.40625, 'C:\\Python25\\lib\\site-pack
ages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXNonUniIta.ttf', 10.0, 57835,
'uniE1EB'), (67.75616455078125, 2.046875, 'C:\\Python25\\
lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXGeneralItalic.ttf',
7.0, 120378, 'u1D63A')], [], {'C:\\Python25\\lib\\si
te-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXGeneralItalic.ttf':
('C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\f
onts\\ttf\\STIXGeneralItalic.ttf', set([120378])),
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf':
('C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf',
set([32, 97, 101, 104, 109, 111, 115, 116, 58]))
,
'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXNonUniIta.ttf':
('C:\\Python25\\lib\\site-packages\\mat
plotlib\\mpl-data\\fonts\\ttf\\STIXNonUniIta.ttf', set([57835]))})
(Pdb) p fonttype, global_fonttype
(42, 42)
> -----Original Message-----
> From: Jouni K. Seppänen [mailto:[email protected]]
> Sent: Monday, October 12, 2009 1:18 PM
> To: [email protected]
> Subject: Re: [Matplotlib-users] Errors with PDF (TeX-string) output
> using Qt4Agg
>
> <[email protected]> writes:
>
> > File "C:\Python25\Lib\site-
> packages\matplotlib\backends\backend_pdf.py", line 1378, in
> draw_mathtext
> > self.file.output(self.encode_string(unichr(num), fonttype),
> Op.show)
> > ValueError: unichr() arg not in range(0x10000) (narrow Python build)
>
> Right, IPython really had mangled the traceback. That looks like the
> mathtext parser is outputting some characters outside the Basic
> Multilingual Plane. Could you try the following:
>
> python -i c:\GDAG2009\python\pyTest.py -d pdf
>
> Then when the error occurs, you should be at a Python prompt. Then
> type
> (or just copy and paste from here - be careful with the first two
> lines,
> since any exception will cause Python to forget the existing
> traceback):
>
> from pdb import pm
> pm()
> p fontname, fontsize, num, symbol_name
> p s, width, height, descent, glyphs, rects, used_characters
> p fonttype, global_fonttype
>
> It might work to set pdf.fonttype to 3 in matplotlibrc, but even if it
> helps, it would be useful to find the root of this problem.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
> ----------------------------------------------------------------------
> --------
> 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
------------------------------------------------------------------------------
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