0.99.1.2: error in afm.py

I didn't try then, but just did now. Still the same error:

Found an unknown keyword in AFM header (was Underline)
Traceback (most recent call last):
   File "./eikos.py", line 6, in <module>
     from modelPage import modModel
   File "/home/rshepard/development/trunk/modelPage.py", line 9, in <module>
     from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
FigureCanvas
   File
"/usr/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py",
line 20, in <module>
     from matplotlib.figure import Figure
   File "/usr/lib/python2.6/site-packages/matplotlib/figure.py", line 18, in
<module>
     from axes import Axes, SubplotBase, subplot_class_factory
   File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 14, in
<module>
     import matplotlib.axis as maxis
   File "/usr/lib/python2.6/site-packages/matplotlib/axis.py", line 10, in
<module>
     import matplotlib.font_manager as font_manager
   File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
1323, in <module>
     _rebuild()
   File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
1273, in _rebuild
     fontManager = FontManager()
   File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
997, in __init__
     self.afmlist = createFontList(self.afmfiles, fontext='afm')
   File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
559, in createFontList
     font = afm.AFM(fh)
   File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 305, in
__init__
     parse_afm(fh)
   File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 293, in
parse_afm
     dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
   File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 177, in
_parse_char_metrics
     name = vals[2].split()[1]
IndexError: list index out of range

   Sigh. I'm sure it's as frustrating for you as it is for me.

Thanks,

Rich

···

On Mon, 24 Oct 2011, Rich Shepard wrote:

so no more tracebacks?

  I'll try again tomorrow morning before I head to the dentist.

Well, I hope the dentist trip was more of a success :slight_smile: Don't worry
about it - it's become kind of a fun challenge now.

I see you sent this just a few minutes ago - let's try to figure this
out interactively via IRC on #matplotlib channel on freenode. If you
don't have an IRC client handy, you can just use this web-based one.
http://webchat.freenode.net/?channels=matplotlib

best,

···

On Tue, Oct 25, 2011 at 1:59 PM, Rich Shepard <rshepard@...695...> wrote:

On Mon, 24 Oct 2011, Rich Shepard wrote:

so no more tracebacks?

I'll try again tomorrow morning before I head to the dentist.

I didn't try then, but just did now. Still the same error:

Found an unknown keyword in AFM header (was Underline)
Traceback (most recent call last):
File "./eikos.py", line 6, in <module>
from modelPage import modModel
File "/home/rshepard/development/trunk/modelPage.py", line 9, in <module>
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
FigureCanvas
File
"/usr/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py",
line 20, in <module>
from matplotlib.figure import Figure
File "/usr/lib/python2.6/site-packages/matplotlib/figure.py", line 18, in
<module>
from axes import Axes, SubplotBase, subplot_class_factory
File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 14, in
<module>
import matplotlib.axis as maxis
File "/usr/lib/python2.6/site-packages/matplotlib/axis.py", line 10, in
<module>
import matplotlib.font_manager as font_manager
File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
1323, in <module>
_rebuild()
File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
1273, in _rebuild
fontManager = FontManager()
File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
997, in __init__
self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/python2.6/site-packages/matplotlib/font_manager.py", line
559, in createFontList
font = afm.AFM(fh)
File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 305, in
__init__
parse_afm(fh)
File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 293, in
parse_afm
dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/python2.6/site-packages/matplotlib/afm.py", line 177, in
_parse_char_metrics
name = vals[2].split()[1]
IndexError: list index out of range

Sigh. I'm sure it's as frustrating for you as it is for me.

--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7

Well, I hope the dentist trip was more of a success :slight_smile: Don't worry
about it - it's become kind of a fun challenge now.

Paul,

   Yes, it was a nice, long, relaxing visit. I go to the dental school at the
health sciences university; costs ~ 1/3rd less than a private dentist,
top-notch care, and the latest techniques when necessary.

I see you sent this just a few minutes ago - let's try to figure this out
interactively via IRC on #matplotlib channel on freenode. If you don't
have an IRC client handy, you can just use this web-based one.
Kiwi IRC

   Oops! That was a while ago. I'm rather overwhelmed with client work, but
will see if I still have an IRC tool available on the system; I removed
bitchx a while ago.

Rich

···

On Tue, 25 Oct 2011, Paul Ivanov wrote:

Paul, et al.:

   Changing "underline " to "underline" fixed the problem. Now I have some
legacy database connection issues since pysqlite3 is now included with
python. Ergo, no more matplotlib complaints! (I suppose that removing the
kidsd.* font had nothing to do with it, but I don't use that font in any
case.)

Thanks very much,

Rich

···

On Tue, 25 Oct 2011, Paul Ivanov wrote:

I see you sent this just a few minutes ago - let's try to figure this out
interactively via IRC on #matplotlib channel on freenode. If you don't
have an IRC client handy, you can just use this web-based one.
Kiwi IRC

Awesome! glad we finally got to the bottom of it. For the record - in
case others start seeing this error: "Found an unknown keyword in AFM
header (was Underline)", when the afm file in question splits up the
UnderlinePosition to be two words with a space between them, here's
the patch to fix that problem.

diff --git a/lib/matplotlib/afm.py b/lib/matplotlib/afm.py
index bb51634..127e63d 100644
--- a/lib/matplotlib/afm.py
+++ b/lib/matplotlib/afm.py
@@ -132,6 +132,7 @@ def _parse_header(fh):
         line = fh.readline()
         if not line: break
         line = line.rstrip()
+ line = line.replace("Underline ", "Underline")
         if line.startswith('Comment'): continue
         lst = line.split( ' ', 1 )
         #print '%-s\t%-d line :: %-s' % ( fh.name, len(lst), line )

I won't commit this to trunk, because it doesn't seem like anyone else
has run into this before - so maybe there are very few afm files out
there using this *incorrect*, as far as I can ascertain, version of
the AFM headers

best,

···

On Tue, Oct 25, 2011 at 4:59 PM, Rich Shepard <rshepard@...695...> wrote:

On Tue, 25 Oct 2011, Paul Ivanov wrote:

I see you sent this just a few minutes ago - let's try to figure this out
interactively via IRC on #matplotlib channel on freenode. If you don't
have an IRC client handy, you can just use this web-based one.
Kiwi IRC

Paul, et al.:

Changing "underline " to "underline" fixed the problem. Now I have some
legacy database connection issues since pysqlite3 is now included with
python. Ergo, no more matplotlib complaints! (I suppose that removing the
kidsd.* font had nothing to do with it, but I don't use that font in any
case.)

--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7