Your message dated Fri, 2 May 2008 16:38:58 +0200
with message-id <[EMAIL PROTECTED]>
and subject line Re: [Python-modules-team] Bug#479069: matplotlib 0.90.1 needs
patch to save PDF files under Python 2.5
has caused the Debian Bug report #479069,
regarding matplotlib 0.90.1 needs patch to save PDF files under Python 2.5
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)
--
479069: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479069
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
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 [EMAIL PROTECTED]) to the
[EMAIL PROTECTED] 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
import matplotlib
matplotlib.use("pdf")
from pylab import *
plot([1,2,3])
savefig("test")
Index: backend_pdf.py
===================================================================
--- backend_pdf.py (revision 3418)
+++ backend_pdf.py (working copy)
@@ -500,11 +500,20 @@
# composite font, based on multi-byte characters.
from encodings import cp1252
- firstchar, lastchar = 0, 255
+ # The "decoding_map" was changed to a "decoding_table" as of Python
2.5.
+ if hasattr(cp1252, 'decoding_map'):
+ def decode_char(charcode):
+ return cp1252.decoding_map[charcode] or 0
+ else:
+ def decode_char(charcode):
+ return ord(cp1252.decoding_table[charcode]) or 0
+
def get_char_width(charcode):
- unicode = cp1252.decoding_map[charcode] or 0
+ unicode = decode_char(charcode)
width = font.load_char(unicode, flags=LOAD_NO_SCALE).horiAdvance
return cvt(width)
+
+ firstchar, lastchar = 0, 255
widths = [ get_char_width(charcode) for charcode in range(firstchar,
lastchar+1) ]
widthsObject = self.reserveObject('font widths')
--- End Message ---
--- Begin Message ---
Version: 0.91.2-1
Hi Michael,
we uploaded[1] matplotlib version 0.91.2 in unstable a couple of days
ago, and in other few days it will reach testing (aka, lenny).
That version fixes the bug you reported, so it's just a matter of days
and your lenny machines will have the new version to install.
I tested matplotlib 0.91.2-2 with python 2.5.2 and it works as
expected (test.pdf file is generated and contains the graph).
That said, I close this bug, and I thank you for having reported it!
Kindly,
Sandro
[1] http://packages.qa.debian.org/m/matplotlib.html
--
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
--- End Message ---