I think you've run into this bug:

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

matplotlib-0.90.1 is not compatible with Python 2.5 due to a change made 
in cp1252 in Python 2.5.  You can try applying the patch included with 
the bug report, or upgrading to matplotlib 0.91.2.  A bug should 
probably be submitted to the Debian packagers (I suspect they will want 
to apply the patch if they don't want to upgrade the version).  I'll 
look into doing that.

Cheers,
Mike

Lorenzo Isella wrote:
> Dear All,
> I am running Debian testing on my box and I use pylab as installed
> from the standard repositories.
> Unfortunately, it seems that there is something broken either with
> pylab or Python (I have been upgrading the system these days) since I
> am now unable to create .pdf files:
> For instance, consider the following simple script:
>
>  #! /usr/bin/env python
>
> import scipy as s
> import numpy as n
> import pylab as p
>
>
> a=s.linspace(0.,40.,20)
> b=s.linspace(-20.,90.,20)
>
> fig = p.figure()
> axes = fig.gca()
>
>
> axes.plot(a,b, "bo",label="test plot")
> p.xlabel('Time')
> p.ylabel('Number of clusters')
> p.title("Evolution Number of clusters")
> p.grid(True)
> cluster_name="test.pdf"
> axes.legend()
> p.savefig(cluster_name)
>
> p.clf()
>
>
> The output generated by the script is:
>
> Traceback (most recent call last):
>   File "<stdin>", line 25, in <module>
>   File "/usr/lib/python2.5/site-packages/matplotlib/pylab.py", line
> 796, in savefig
>     return fig.savefig(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line
> 759, in savefig
>     self.canvas.print_figure(*args, **kwargs)
>   File 
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py",
> line 114, in print_figure
>     orientation, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
> line 497, in print_figure
>     printfunc(filename, dpi, facecolor, edgecolor, orientation, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
> line 1395, in print_figure
>     file.close()
>   File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
> line 401, in close
>     self.writeFonts()
>   File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py",
> line 456, in writeFonts
>     fontdictObject = self.embedTTF(filename)
>   File "/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 "/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'
>
> and no pdf file is produced. However, if I try saving it as a .png
> file (by setting  cluster_name="test.png"), then everything works
> fine.
> This is very annoying and I wonder if anyone else is having the same
> problem and can put forward a suggestion to help.
> Many thanks
>
> Lorenzo
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

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


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to