Strange error after installing matplotlib from macports

Damon McDougall <damon.mcdougall@...287...> writes:

>>> from matplotlib.figure import Figure
ValueError: invalid literal for int() with base 10: '836.364'

I have no clue what is going on. Does anybody have any ideas?

Could you do the following: (if you already exited that Python shell
and can't reproduce the problem any longer, you can delete your
~/.matplotlib/fontList.cache and try again)

from pdb import pm
pm()

This should get you to a debugger. Then type:

up
p fh
p line
p vals

to get some more information on what is going wrong.

···

--
Jouni K. Sepp�nen

Hi Jouni,

Sure. Here is the output from your suggestion:

Python 2.5.4 (r254:67916, Sep 15 2009, 11:16:42)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pdb import pm
>>> from matplotlib.figure import Figure
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/opt/local/lib/python2.5/site-packages/matplotlib/figure.py", line 19, in <module>
     from axes import Axes, SubplotBase, subplot_class_factory
   File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py", line 12, in <module>
     import matplotlib.axis as maxis
   File "/opt/local/lib/python2.5/site-packages/matplotlib/axis.py", line 10, in <module>
     import matplotlib.font_manager as font_manager
   File "/opt/local/lib/python2.5/site-packages/matplotlib/font_manager.py", line 1301, in <module>
     _rebuild()
   File "/opt/local/lib/python2.5/site-packages/matplotlib/font_manager.py", line 1292, in _rebuild
     fontManager = FontManager()
   File "/opt/local/lib/python2.5/site-packages/matplotlib/font_manager.py", line 1010, in __init__
     self.afmlist = createFontList(self.afmfiles, fontext='afm')
   File "/opt/local/lib/python2.5/site-packages/matplotlib/font_manager.py", line 578, in createFontList
     font = afm.AFM(fh)
   File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 294, in __init__
     parse_afm(fh)
   File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 282, in parse_afm
     dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
   File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 168, in _parse_char_metrics
     bbox = _to_list_of_ints(vals[3][2:])
   File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 47, in _to_list_of_ints
     return [_to_int(val) for val in s.split()]
ValueError: invalid literal for int() with base 10: '836.364'
>>> pm()
> /opt/local/lib/python2.5/site-packages/matplotlib/afm.py(47)_to_list_of_ints()
-> return [_to_int(val) for val in s.split()]
(Pdb) up
> /opt/local/lib/python2.5/site-packages/matplotlib/afm.py(168)_parse_char_metrics()
-> bbox = _to_list_of_ints(vals[3][2:])
(Pdb) p fh
<closed file '/Users/Damon/Library/Fonts/lcmssi8.afm', mode 'r' at 0x1019b67b0>
(Pdb) p line
'C 0 ; WX 708.333 ; N Gamma ; B 0 0 836.364 684.027 ;'
(Pdb) p vals
['C 0 ', ' WX 708.333 ', ' N Gamma ', ' B 0 0 836.364 684.027 ']

Also, after some curiosity, I realised the file ~/.matplotlib/fontList.cache doesn't exist. In fact, the ~/.matplotlib directory is empty, there aren't even any hidden files. On my other computer, matplotlib works fine and the ~/.matplotlib directory contains three files: fontList.cache, fontManager.cache and tex.cache.

Hope this explains more. Thanks in advance for any help.
Regards,
--Damon

···

On 15 Sep 2009, at 11:42, Jouni K. Seppänen wrote:

Damon McDougall <damon.mcdougall@...287...> writes:

from matplotlib.figure import Figure

ValueError: invalid literal for int() with base 10: '836.364'

I have no clue what is going on. Does anybody have any ideas?

Could you do the following: (if you already exited that Python shell
and can't reproduce the problem any longer, you can delete your
~/.matplotlib/fontList.cache and try again)

from pdb import pm
pm()

This should get you to a debugger. Then type:

up
p fh
p line
p vals

to get some more information on what is going wrong.

--
Jouni K. Seppänen
Jouni Seppänen

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options