import problem after upgrade to matplotlib 1.3.1-1

After upgrading to matplotlib 1.3.1-1 importing matplotlib.pyplot fails with the error:

Python 2.7.5+ (default, Sep 17 2013, 15:31:50)

[GCC 4.8.1] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

import matplotlib.pyplot

Found an unknown keyword in AFM header (was Each)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was Each)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was Each)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was Each)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Traceback (most recent call last):

File “”, line 1, in

File “/usr/lib/pymodules/python2.7/matplotlib/pyplot.py”, line 24, in

import matplotlib.colorbar

File “/usr/lib/pymodules/python2.7/matplotlib/colorbar.py”, line 29, in

import matplotlib.collections as collections

File “/usr/lib/pymodules/python2.7/matplotlib/collections.py”, line 23, in

import matplotlib.backend_bases as backend_bases

File “/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py”, line 50, in

import matplotlib.textpath as textpath

File “/usr/lib/pymodules/python2.7/matplotlib/textpath.py”, line 11, in

import matplotlib.font_manager as font_manager

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1356, in

_rebuild()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1341, in _rebuild

fontManager = FontManager()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1008, in init

self.afmlist = createFontList(self.afmfiles, fontext=‘afm’)

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 563, in createFontList

font = afm.AFM(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 342, in init

parse_afm(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 331, in parse_afm

doptional = _parse_optional(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 313, in _parse_optional

d[key] = optionalkey

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 246, in _parse_kern_pairs

c1, c2, val = _to_str(vals[1]), _to_str(vals[2]), _to_float(vals[3])

ValueError: could not convert string to float: -'0

The problem is with the Adobe Font Metric. Has anyone run into this problem and found a solution or workaround? Any help is greatly appreciated.

My system is Debian testing with Python 2.7.5 and NumPy 1.7.1-3.

Thanks,

···


Ivan Lima
Woods Hole Oceanographic Institution, MC&G MS #25
360 Woods Hole Road, Woods Hole, MA 02543-1543 USA

After a bit of digging I found that the problem is caused by the line:

KPX Y ydieresis -'0

in the font files jkplmsc8a.afm and jkpmsc8a.afm installed with the package texlive-fonts-extra. When afm.py parses this line it fails because it can’t convert the last token “-'0” to float.

I don’t know much about AFM so I’m not sure what is the best way to fix this. Should I modify afm.py to handle this line (remove the single quote) or edit the afm files? And to whom should I send a bug report, matplotlib or texlive-fonts-extra?

Thanks,

  • Ivan
···


Ivan Lima
Woods Hole Oceanographic Institution, MC&G MS #25
360 Woods Hole Road, Woods Hole, MA 02543-1543 USA

On Fri, Nov 1, 2013 at 5:13 PM, Ivan Lima <ivan@…3641…> wrote:

After upgrading to matplotlib 1.3.1-1 importing matplotlib.pyplot fails with the error:

Python 2.7.5+ (default, Sep 17 2013, 15:31:50)

[GCC 4.8.1] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

import matplotlib.pyplot

Found an unknown keyword in AFM header (was Each)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was Each)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was Each)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was Each)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Found an unknown keyword in AFM header (was )

Found an unknown keyword in AFM header (was The)

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Value error parsing header in AFM: UnderlinePosition -41,5039

Value error parsing header in AFM: UnderlineThickness 43,9453

Traceback (most recent call last):

File “”, line 1, in

File “/usr/lib/pymodules/python2.7/matplotlib/pyplot.py”, line 24, in

import matplotlib.colorbar

File “/usr/lib/pymodules/python2.7/matplotlib/colorbar.py”, line 29, in

import matplotlib.collections as collections

File “/usr/lib/pymodules/python2.7/matplotlib/collections.py”, line 23, in

import matplotlib.backend_bases as backend_bases

File “/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py”, line 50, in

import matplotlib.textpath as textpath

File “/usr/lib/pymodules/python2.7/matplotlib/textpath.py”, line 11, in

import matplotlib.font_manager as font_manager

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1356, in

_rebuild()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1341, in _rebuild

fontManager = FontManager()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1008, in init

self.afmlist = createFontList(self.afmfiles, fontext=‘afm’)

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 563, in createFontList

font = afm.AFM(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 342, in init

parse_afm(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 331, in parse_afm

doptional = _parse_optional(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 313, in _parse_optional

d[key] = optionalkey

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 246, in _parse_kern_pairs

c1, c2, val = _to_str(vals[1]), _to_str(vals[2]), _to_float(vals[3])

ValueError: could not convert string to float: -'0

The problem is with the Adobe Font Metric. Has anyone run into this problem and found a solution or workaround? Any help is greatly appreciated.

My system is Debian testing with Python 2.7.5 and NumPy 1.7.1-3.

Thanks,


Ivan Lima
Woods Hole Oceanographic Institution, MC&G MS #25
360 Woods Hole Road, Woods Hole, MA 02543-1543 USA