From: <kc1...@ya...> - 2007-03-13 23:39:23
|
Sorry, Jouni: I am not familiar with CVS syntax. Is there someway you can = email me a complete backend_pdf.py to try?=0A=0ARegards,=0A=0A> -----Origin= al Message-----=0A> From: mat...@li... = =0A> [mailto:mat...@li...] On =0A> Behalf= Of Jouni K. Sepp=E4nen=0A> Sent: Monday, March 12, 2007 11:20 PM=0A> To: m= atp...@li...=0A> Subject: Re: [Matplotlib-users] P= DF backend problem=0A> =0A> =0A> I fixed another filehandle leak in the pdf= backend, so here's =0A> a more complete patch. There are also several case= s of =0A> file(...) being passed to pickle.dump or pickle.load in =0A> font= _manager.py. I was going to take care of these by writing =0A> some utility= functions, but I started wondering why the =0A> import of cPickle or pickl= e is done only within methods of =0A> FontManager and not at the top level.= Are there some =0A> platforms where neither is available, or what is the r= ationale?=0A> =0A> Index: backend_pdf.py =0A> =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=0A> --- backend_pdf.py (revision 3044)=0A> ++= + backend_pdf.py (revision 3046)=0A> @@ -457,7 +457,9 @@=0A> = self.writeObject(self.fontObject, fonts)=0A> =0A> def _write_afm_= font(self, filename):=0A> - font =3D AFM(file(filename))=0A> + = fh =3D file(filename)=0A> + font =3D AFM(fh)=0A> + fh.close= ()=0A> fontname =3D font.get_fontname()=0A> fontdict =3D = { 'Type': Name('Font'),=0A> 'Subtype': Name('Type1'),= =0A> @@ -1081,7 +1083,9 @@=0A> font =3D self.afm_font_cache.get(ke= y)=0A> if font is None:=0A> filename =3D fontManager.= findfont(prop, fontext=3D'afm')=0A> - font =3D AFM(file(filename= ))=0A> + fh =3D file(filename)=0A> + font =3D AFM(fh)= =0A> + fh.close()=0A> self.afm_font_cache[key] =3D = font=0A> return font=0A> =0A> -- =0A> Jouni K. Sepp=E4nen=0A> http= ://www.iki.fi/jks=0A> =0A> =0A> -------------------------------------------= -------------------=0A> -----------=0A> Take Surveys. Earn Cash. Influence = the Future of IT=0A> Join SourceForge.net's Techsay panel and you'll get th= e =0A> chance to share your opinions on IT & business topics through =0A> b= rief surveys-and earn cash =0A> http://www.techsay.com/default.php?page=3Dj= oin.php&p=3Dsourceforge=0A&CID=3DDEVDEV=0A_________________________________= ______________=0AMatplotlib-users mailing list Mat...@li...urc= eforge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/matplotlib-users= =0A=0A =0A--=0AJohn Henry=0A=0A |