PDF backend problem


Are you certain the version you sent me is correct? It didn't make any difference - I get the same error messages.



-----Original Message-----
From: matplotlib-users-bounces@lists.sourceforge.net
[mailto:matplotlib-users-bounces@lists.sourceforge.net] On
Behalf Of Jouni K. Seppänen
Sent: Monday, March 12, 2007 11:20 PM
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] PDF backend problem

I fixed another filehandle leak in the pdf backend, so here's
a more complete patch. There are also several cases of
file(...) being passed to pickle.dump or pickle.load in
font_manager.py. I was going to take care of these by writing
some utility functions, but I started wondering why the
import of cPickle or pickle is done only within methods of
FontManager and not at the top level. Are there some
platforms where neither is available, or what is the rationale?

Index: backend_pdf.py

--- backend_pdf.py (revision 3044)
+++ backend_pdf.py (revision 3046)
@@ -457,7 +457,9 @@
         self.writeObject(self.fontObject, fonts)
     def _write_afm_font(self, filename):
- font = AFM(file(filename))
+ fh = file(filename)
+ font = AFM(fh)
+ fh.close()
         fontname = font.get_fontname()
         fontdict = { 'Type': Name('Font'),
                      'Subtype': Name('Type1'),
@@ -1081,7 +1083,9 @@
         font = self.afm_font_cache.get(key)
         if font is None:
             filename = fontManager.findfont(prop, fontext='afm')
- font = AFM(file(filename))
+ fh = file(filename)
+ font = AFM(fh)
+ fh.close()
             self.afm_font_cache[key] = font
         return font

Jouni K. Seppänen

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your opinions on IT & business topics through
brief surveys-and earn cash

Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net

John Henry