I think you may have an .afm font file on your system that the AFM parser in matplotlib is having trouble with.
Can you use the debugger to figure out what the value of "fpath" is on line 578 of font_manager.py is in the traceback below? Then we could figure out what the difficult file is. Mike On 11/25/2010 08:54 PM, Daoliang Tan wrote: > Dear all, > > I am facing a weird problem when I import pylab or pyplot modules. > Right now, I can successfully import matplotlib. But after I issue > the command "ipython -pylab --verbose-helpful", I get the following > error: > ================================================================================================================================================= > $HOME=/home/michael > CONFIGDIR=/home/michael/.matplotlib > matplotlib data path /usr/share/matplotlib/mpl-data > loaded rc file /etc/matplotlibrc > matplotlib version 0.99.3 > verbose.level helpful > interactive is False > units is False > platform is linux2 > font search path ['/usr/share/matplotlib/mpl-data/fonts/ttf', > '/usr/share/matplotlib/mpl-data/fonts/afm'] > Traceback (most recent call last): > File "/usr/bin/ipython", line 28, in<module> > IPython.Shell.start().mainloop() > File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 1241, in start > return shell(user_ns = user_ns) > File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 1106, in > __init__ > shell_class=MatplotlibShell) > File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 73, in __init__ > debug=debug,shell_class=shell_class) > File "/usr/lib/pymodules/python2.6/IPython/ipmaker.py", line 100, in > make_IPython > embedded=embedded,**kw) > File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 627, in __init__ > user_ns,user_global_ns,b2 = > self._matplotlib_config(name,user_ns,user_global_ns) > File "/usr/lib/pymodules/python2.6/IPython/Shell.py", line 556, in > _matplotlib_config > import matplotlib.pylab as pylab > File "/usr/lib/pymodules/python2.6/matplotlib/pylab.py", line 206, > in<module> > from matplotlib import mpl # pulls in most modules > File "/usr/lib/pymodules/python2.6/matplotlib/mpl.py", line 2, in<module> > from matplotlib import axis > File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 10, in<module> > import matplotlib.font_manager as font_manager > File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line > 1301, in<module> > _rebuild() > File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line > 1292, in _rebuild > fontManager = FontManager() > File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line > 1010, in __init__ > self.afmlist = createFontList(self.afmfiles, fontext='afm') > File "/usr/lib/pymodules/python2.6/matplotlib/font_manager.py", line > 578, in createFontList > font = afm.AFM(fh) > File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 303, in > __init__ > parse_afm(fh) > File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 291, in > parse_afm > dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) > File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 176, in > _parse_char_metrics > bbox = _to_list_of_floats(vals[3][2:]) > File "/usr/lib/pymodules/python2.6/matplotlib/afm.py", line 58, in > _to_list_of_floats > return [_to_float(val) for val in s.split()] > ValueError: invalid literal for float(): uni2605 > =========================================================================================================================================== > > Each time, as long as I import pylab OR pyplot, I will obtain > "ValueError: invalid literal for float(): uni2605". After googling a > long time, I can not get an idea to address this issue. Can anyone > give me some hints? > > My computer configuration is the following: > > 1. OS: debian squeeze Linux 2.6.32-5-amd64 #1 SMP Sat Oct 30 14:18:21 > UTC 2010 x86_64 GNU/Linux > 2. matplotlib version: 0.99.3 > 3. The matplotlib is installed from the debian repository. > 4. no any special customization of "matplotlibrc" > 5. import pylab will produce this error. > 6. python version: 2.6.6-3 > > > I have reinstalled these packages many times and this does not solve > this issue. > > Thanks for your help! > > Daoliang > > ------------------------------------------------------------------------------ > Increase Visibility of Your 3D Game App& Earn a Chance To Win $500! > Tap into the largest installed PC base& get more eyes on your game by > optimizing for Intel(R) Graphics Technology. Get started today with the > Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. > http://p.sf.net/sfu/intelisp-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users