Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg

2009-10-12 Thread Jouni K . Seppänen
phob...@geosyntec.com writes:

 |C:\Documents and Settings\phobsonipython26 -pylab

Could you try this in plain Python? I'm asking because you seem to be
getting an IPython warning about a possibly corrupted traceback:

 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))

I suggest you write your commands in a script and run it with 

python script.py --verbose-debug

so that we can get a better picture of where it is going wrong.

Also, does it matter that you are using Qt4Agg? You can test this by
trying

python script.py -d pdf --verbose-debug

If that works, then the problem could be related to Qt4Agg specifically,
but if it fails, it is somewhere else.

-- 
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg

2009-10-12 Thread PHobson
Sheesh it's been a weird day. I failed to reply to the whole list. 

Jouni, sorry about the duplciate message...




 phob...@geosyntec.com writes:
  |C:\Documents and Settings\phobsonipython26 -pylab

 From: Jouni K. Seppänen [mailto:j...@iki.fi] Could you try this in 
 plain Python? I'm asking because you seem to be getting an IPython 
 warning about a possibly corrupted traceback:
 
  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))
 
 I suggest you write your commands in a script and run it with
 
 python script.py --verbose-debug

Jouni: Thanks for the prompt reply. I did just that. Calling the script both 
ways (w/ and w/o the PDF backend) fails with a lot of out. This time I've 
included the verbose output as an attached text file. I apologize of that's a 
mailing list faux pas. Here's the code for the script, pyTest.py:

import pylab as pl
x = pl.arange(6)
y = x + 5
pl.plot(x,y,'ko', zorder=10)
pl.xlabel('X-label, no TeX')
pl.ylabel('Y-label. no math')
pl.savefig('no_math.png')
pl.savefig('no_math.pdf')

pl.xlabel(r'some math: $\tau_{y}$')
pl.savefig('some_math.png')
pl.savefig('some_math.pdf')
# EOF

no_math.* and some_math.png are created just fine. The error occurred trying to 
create some_math.pdf.

I'm really at a loss b/c I could swear I created fairly complex figures with 
output to PDF about a week ago and don't recall changing my Python or MPL 
installation.

 so that we can get a better picture of where it is going wrong.
 
 Also, does it matter that you are using Qt4Agg? You can test this by 
 trying

Both seemed to provide the same error message, so I've only included the 
verbose output from C:\Python25python c:\GDAG2009\python\pyTest.py -d pdf 
--verbose-debug

For grins and giggles, I went to my matplotlibrc file and commented out the 
lines telling MPL to use Droid fonts (even though they never gave me a problem 
before). That didn't change anything.

Thanks again,
-paul
C:\Python25python c:\GDAG2009\python\pyTest.py -d pdf --verbose-debug
$HOME=C:\Documents and Settings\phobson
CONFIGDIR=C:\Documents and Settings\phobson\.matplotlib
matplotlib data path C:\Python25\lib\site-packages\matplotlib\mpl-data
loaded rc file C:\Documents and Settings\phobson\.matplotlib\matplotlibrc
matplotlib version 0.99.1
verbose.level debug
interactive is False
units is False
platform is win32
loaded modules: ['numpy.lib._iotools', 'xml.sax.urlparse', 'distutils', 
'matplotlib.errno', 'pylab', 'subprocess', 'gc', 'matplotl
ib.tempfile', 'distutils.sysconfig', 'ctypes._endian', 'encodings.encodings', 
'matplotlib.colors', 'msvcrt', 'numpy.testing.sys',
'numpy.core.info', 'xml', 'numpy.fft.types', 'numpy.ma.operator', 
'numpy.ma.cPickle', 'struct', 'numpy.random.info', 'tempfile', '
xml.sax.urllib', 'numpy.linalg', 'matplotlib.threading', 
'numpy.testing.operator', 'imp', 'numpy.testing', 'collections', 'numpy.c
ore.umath', '_struct', 'distutils.types', 'numpy.lib.numpy', 
'numpy.core.scalarmath', 'matplotlib.matplotlib', 'string', 'matplotl
ib.subprocess', 'numpy.testing.os', 'matplotlib.locale', 
'numpy.lib.arraysetops', 'numpy.testing.unittest', 'numpy.lib.math', 'mat
plotlib.__future__', 'numpy.testing.re', 'itertools', 'numpy.version', 
'numpy.lib.re', 'distutils.re', 'ctypes.os', 'numpy.core.os
', 'numpy.lib.type_check', 'numpy.lib.__builtin__', 'signal', 
'numpy.lib.types', 'numpy.lib._datasource', 'random', 'threading', '
token', 'numpy.fft.fftpack_lite', 'matplotlib.cbook', 'ctypes.ctypes', 
'xml.sax.xmlreader', 'numpy.__builtin__', 'dis', 'distutils
.version', 'cStringIO', 'numpy.ma.core', 'numpy.numpy', 'matplotlib.StringIO', 
'locale', 'numpy.add_newdocs', 'numpy.lib.getlimits
', 'xml.sax.saxutils', 'matplotlib.numpy', 'numpy.lib.sys', 'encodings', 
'numpy.ma.itertools', 'numpy.lib.io', 'numpy.ma.extras',
'numpy.testing.decorators', 'matplotlib.warnings', 'matplotlib.string', 
'_subprocess', 'urllib', 'matplotlib.sys', 're', 'numpy.li
b._compiled_base', 'ntpath', 'new', 'numpy.random.mtrand', 'math', 
'numpy.fft.helper', 'numpy.ma.warnings', 'inspect', 'numpy.ma.i
nspect', 'UserDict', 'numpy.lib.function_base', 'distutils.os', 'matplotlib', 
'numpy.fft.numpy', 'numpy.lib.ufunclike', 'numpy.lib
.info', 'numpy.core.numerictypes', 'ctypes', 'numpy.lib.warnings', 
'ctypes.struct', 'codecs', 'numpy.core._sort', 'numpy.os', '_lo
cale', 'matplotlib.sre_constants', 'matplotlib.os', 'thread', 'StringIO', 
'numpy.core.memmap', 'traceback', 'weakref', 'numpy.core
._internal', 'numpy.fft.fftpack', 'opcode', 'numpy.linalg.lapack_lite', 
'distutils.sys', 'os', 'numpy.lib.itertools', '__future__'
, 'matplotlib.copy', 'xml.sax.types', 'matplotlib.traceback', '_sre', 
'unittest', 'numpy.core.sys', 'numpy.random', 'numpy.linalg.
numpy', '__builtin__', 'numpy.lib.twodim_base', 'matplotlib.re', 
'numpy.core.cPickle', 'operator', 'numpy.core.arrayprint', 'distu
tils.string', 

Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg

2009-10-12 Thread Jouni K . Seppänen
phob...@geosyntec.com 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(0x1) (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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg

2009-10-12 Thread Michael Droettboom
On 10/12/2009 04:17 PM, Jouni K. Seppänen wrote:
 phob...@geosyntec.com  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(0x1) (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.


What is your mathtext.fontset setting?  If it's stixsans, then it is 
possible that mathtext would produce codepoints outside of the BMP (this 
is due to the way the STIX fonts are encoded).  Unfortunately, the 
standard Python builds for Windows don't support characters in this range.

There might actually be a work around possible in the PDF backend -- but 
it will have to involve encoding Unicode characters without using Python 
unicode objects.  I'm looking into a patch now.

Cheers,
Mike

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg

2009-10-12 Thread PHobson
\\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:j...@iki.fi]
 Sent: Monday, October 12, 2009 1:18 PM
 To: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] Errors with PDF (TeX-string) output
 using Qt4Agg
 
 phob...@geosyntec.com 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(0x1) (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
 Matplotlib-users@lists.sourceforge.net
 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg

2009-10-12 Thread PHobson
Mike,

Thanks for the reply. I found that I had (on a whim) set my mathtext.fontset to 
stixsans and then forgot about it. Returning that value to cm fixes my issues. 
In short, I'm all squared away now. Thanks!

Paul M. Hobson  


 -Original Message-
 From: Michael Droettboom [mailto:md...@stsci.edu]
 Sent: Monday, October 12, 2009 1:38 PM
 To: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] Errors with PDF (TeX-string) output
 using Qt4Agg
 
 On 10/12/2009 04:17 PM, Jouni K. Seppänen wrote:
  phob...@geosyntec.com  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(0x1) (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.
 
 
 What is your mathtext.fontset setting?  If it's stixsans, then it is
 possible that mathtext would produce codepoints outside of the BMP
 (this
 is due to the way the STIX fonts are encoded).  Unfortunately, the
 standard Python builds for Windows don't support characters in this
 range.
 
 There might actually be a work around possible in the PDF backend --
 but
 it will have to involve encoding Unicode characters without using
 Python
 unicode objects.  I'm looking into a patch now.
 
 Cheers,
 Mike
 
 --
 
 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
 Matplotlib-users@lists.sourceforge.net
 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg

2009-10-12 Thread Michael Droettboom
, 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:j...@iki.fi]
 Sent: Monday, October 12, 2009 1:18 PM
 To: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] Errors with PDF (TeX-string) output
 using Qt4Agg

 phob...@geosyntec.com  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(0x1) (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
 Matplotlib-users@lists.sourceforge.net
 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
 Matplotlib-users@lists.sourceforge.net
 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users