--- Begin Message --- Python 2.5 changed encodings.cp1252.decoding_map to a decoding_table.
There is a fix for this in matplotlib SVN.  See this bug:

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

You should be able to use the patch to fix your local copy, to tie you over until the next release.

Cheers,
Mike

Lionel Roubeyrie wrote:
Hi all,
I've got a problem with saving plots in pdf format like you can see in the following output. It seems encodings.cp1252 doesn't have a decoding_map method (but a decoding_table one).
Is it a bug or a problem in my encodings file?
thanks

############################
|Diagrammes|[68]>matplotlib.__version__
        Out [68]:'0.90.1'

|Diagrammes|[69]>plot(arange(6))
        Out [69]:[<matplotlib.lines.Line2D instance at 0x8cd0b2c>]

|Diagrammes|[70]>savefig('tutu.pdf')
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

/home/lionel/Diagrammes/<ipython console> in <module>()

/usr/lib/python2.5/site-packages/matplotlib/pylab.py in savefig(*args, **kwargs)
    794 def savefig(*args, **kwargs):
    795     fig = gcf()
--> 796     return fig.savefig(*args, **kwargs)
    797 if Figure.savefig.__doc__ is not None:
    798     savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/python2.5/site-packages/matplotlib/figure.py in savefig(self, *args, **kwargs)
    757                 kwargs[key] = rcParams['savefig.%s'%key]
    758
--> 759         self.canvas.print_figure(*args, **kwargs)
    760
    761     def colorbar(self, mappable, cax=None, **kw):

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, **kwargs)
    495         if printfunc is not None:
    496             try:
--> 497 printfunc(filename, dpi, facecolor, edgecolor, orientation, **kwargs)
    498             except:
    499                 # restore the original figure properties

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, **kwargs)
   1393         self.figure.draw(renderer)
   1394         renderer.finalize()
-> 1395         file.close()
   1396
   1397 class FigureManagerPdf(FigureManagerBase):

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py in close(self)
    399         # objects
    400         self.endStream()
--> 401         self.writeFonts()
    402         self.writeObject(self.alphaStateObject,
    403                          dict([(val[0], val[1])

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py in writeFonts(self)
    454                 fontdictObject = self._write_afm_font(filename)
    455             else:
--> 456                 fontdictObject = self.embedTTF(filename)
    457             fonts[Fx] = fontdictObject
    458             #print >>sys.stderr, filename

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py in embedTTF(self, filename) 506 width = font.load_char(unicode, flags=LOAD_NO_SCALE).horiAdvance
    507             return cvt(width)
--> 508 widths = [ get_char_width(charcode) for charcode in range(firstchar, lastchar+1) ]
    509
    510         widthsObject = self.reserveObject('font widths')

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py in get_char_width(charcode)
    503         firstchar, lastchar = 0, 255
    504         def get_char_width(charcode):
--> 505             unicode = cp1252.decoding_map[charcode] or 0
506 width = font.load_char(unicode, flags=LOAD_NO_SCALE).horiAdvance
    507             return cvt(width)

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'decoding_map'

################################



--- End Message ---
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to