I have the same bug, but with cyrillic letter "я" (KeyError: 255).
Code to reproduce:

from matplotlib import rc
rc('text', usetex=True)
rc('text.latex',unicode=True)
rc('text.latex',preamble='\usepackage[utf8]{inputenc}')
rc('text.latex',preamble='\usepackage[russian]{babel}')
pyplot.title(u"багряный месяц") # just exaple of using this letter

It also reproduce with the code described in bug.
So, the "stupid" recipe to remove this error is just place "buggy" lines into 
try..except. This seems correct, if you have other, non-buggy letters in 
unicode string.

Here is the patch:

--- dviread.py  2009-08-01 23:15:08.000000000 +0400
+++ /usr/lib/python2.6/site-packages/matplotlib/dviread.py      2009-09-15 
17:36:10.000000000 +0400
@@ -88,8 +88,13 @@ class Dvi(object):
                 e = 0           # zero depth
             else:               # glyph
                 x,y,font,g,w = elt
-                h = _mul2012(font._scale, font._tfm.height[g])
-                e = _mul2012(font._scale, font._tfm.depth[g])
+                try:
+                    h = _mul2012(font._scale, font._tfm.height[g])
+                    e = _mul2012(font._scale, font._tfm.depth[g])
+                except KeyError:
+                    print "Exception in dviread.py! g =", g
+                    h = 0
+                    e = 0

-- 
umlauts cause KeyError
https://bugs.launchpad.net/bugs/394502
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to