Bug in dviread?

Hello to all,

using a standard python install on Ubuntu 10.04 the example fails to produce a figure.

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import matplotlib
matplotlib.__version__

'0.99.1.1'

Test case in python:

from numpy import sin, cos

import matplotlib
import matplotlib.pyplot as plt
plt.matplotlib.rc('text', usetex = True)
import pylab
fig = plt.figure()
ax = fig.add_subplot(111)
t = pylab.linspace(0,10,400)
ax.plot(t, sin(3*t), '-',
      t, sin(0.3*t**2), '--',
      t, cos(t), '-.')
ax.legend((r'A^\{\\omega\}', r'A^\{2\\omega\}', r'A^\{3\\omega\}'),
      shadow = False, loc = (0.75, 0.1))
ax.set_xlabel(r'\\gamma\_1 \+ \\gamma\_2', {'fontsize' : 20 })
ax.set_ylabel(r'A^\{n\\omega\} (dB)', {'fontsize' : 20 })

fig.savefig(filename='test.pdf')

This leads to the following traceback:

Traceback (most recent call last):
   File "test.py", line 18, in <module>
     fig.savefig(filename='test.pdf')
   File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1032, in savefig
     self.canvas.print_figure(*args, **kwargs)
   File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1476, in print_figure
     **kwargs)
   File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1334, in print_pdf
     return pdf.print_pdf(*args, **kwargs)
   File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 2025, in print_pdf
     self.figure.draw(renderer)
   File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper
     draw(artist, renderer, *kl)
   File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 773, in draw
     for a in self.axes: a.draw(renderer)
   File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper
     draw(artist, renderer, *kl)
   File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1735, in draw
     a.draw(renderer)
   File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper
     draw(artist, renderer, *kl)
   File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 742, in draw
     tick.draw(renderer)
   File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper
     draw(artist, renderer, *kl)
   File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 196, in draw
     self.label1.draw(renderer)
   File "/usr/lib/pymodules/python2.6/matplotlib/text.py", line 553, in draw
     self._fontproperties, angle)
   File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 1431, in draw_tex
     psfont = self.tex_font_mapping(dvifont.texname)
   File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 1264, in tex_font_mapping
     dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
   File "/usr/lib/pymodules/python2.6/matplotlib/dviread.py", line 668, in __init__
     self._parse(file)
   File "/usr/lib/pymodules/python2.6/matplotlib/dviread.py", line 701, in _parse
     self._register(words)
   File "/usr/lib/pymodules/python2.6/matplotlib/dviread.py", line 727, in _register
     assert encoding is None
AssertionError

I assume that the errors happens during parsing of the file 8r.enc (http://tug.org/fontname/8r.enc). This file belongs to TexLive 2010 and can also be found identically in MikTeX 2.9. I could only reproduce the error in Linux so far. Any help would be appreciated.

Alexander