[Python-modules-team] Bug#479069: matplotlib 0.90.1 needs patch to save PDF files under Python 2.5

Michael Droettboom mdroe at stsci.edu
Fri May 2 14:19:11 UTC 2008


Package: matplotlib
Version: 0.90.1-4
Severity: important

An API changed between Python 2.4 and Python 2.5 such that matplotlib 
0.90.1 can no longer output PDF files using its (non-Cairo) PDF backend.

There is a matplotlib bug report for this issue here:

http://sourceforge.net/tracker/index.php?func=detail&aid=1738494&group_id=80706&atid=560720

To replicate run the attached Python script:

 > python pdf_broken.py
Traceback (most recent call last):
  File "pdf_broken.py", line 7, in <module>
    savefig("test")
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/pylab.py", line 
796, in savefig
    return fig.savefig(*args, **kwargs)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
759, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", 
line 1395, in print_figure
    file.close()
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", 
line 401, in close
    self.writeFonts()
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", 
line 456, in writeFonts
    fontdictObject = self.embedTTF(filename)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", 
line 508, in embedTTF
    widths = [ get_char_width(charcode) for charcode in range(firstchar, 
lastchar+1) ]
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", 
line 505, in get_char_width
    unicode = cp1252.decoding_map[charcode] or 0
AttributeError: 'module' object has no attribute 'decoding_map'

The attached patch against lib/matplotlib/backends/backend_pdf.py 
corrects this issue.

I am not currently a Debian user.  This issue was reported by a 
matplotlib user (Lorenzo Isella lorenzo.isella at gmail.com) to the 
matplotlib-users at lists.sourceforge.net.  This issue should appear 
whenever matplotlib-0.90.1 is run with Python-2.5, which appears to be 
only on "lenny".  "etch" has matplotlib-0.87 and Python-2.4, and "sid" 
has matplotlib-0.91.2 (which incorporates the included patch upstream) 
and Python-2.5.

Cheers,
Michael Droettboom

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pdf_broken.py
Url: http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20080502/2a384bac/attachment-0002.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 1738494.patch
Url: http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20080502/2a384bac/attachment-0003.txt 


More information about the Python-modules-team mailing list