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 |
From: <kc1...@ya...> - 2007-03-14 21:16:07
|
Jouni,=0A=0AAre you certain the version you sent me is correct? It didn't = make any difference - I get the same error messages.=0A=0ARegards,=0A=0A> -= ----Original Message-----=0A> From: mat...@li...urcefo= rge.net =0A> [mailto:mat...@li...] On =0A= > Behalf Of Jouni K. Sepp=E4nen=0A> Sent: Monday, March 12, 2007 11:20 PM= =0A> To: mat...@li...=0A> Subject: Re: [Matplotli= b-users] PDF 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 se= veral cases 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> so= me utility functions, but I started wondering why the =0A> import of cPickl= e or pickle is done only within methods of =0A> FontManager and not at the = top level. Are there some =0A> platforms where neither is available, or wha= t is the rationale?=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 304= 4)=0A> +++ backend_pdf.py (revision 3046)=0A> @@ -457,7 +457,9 @@=0A> = self.writeObject(self.fontObject, fonts)=0A> =0A> def _w= rite_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> font= dict =3D { 'Type': Name('Font'),=0A> 'Subtype': Name(= 'Type1'),=0A> @@ -1081,7 +1083,9 @@=0A> font =3D self.afm_font_cac= he.get(key)=0A> if font is None:=0A> filename =3D fon= tManager.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_cach= e[key] =3D font=0A> return font=0A> =0A> -- =0A> Jouni K. Sepp=E4n= en=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 yo= u'll get the =0A> chance to share your opinions on IT & business topics thr= ough =0A> brief surveys-and earn cash =0A> http://www.techsay.com/default.p= hp?page=3Djoin.php&p=3Dsourceforge=0A&CID=3DDEVDEV=0A______________________= _________________________=0AMatplotlib-users mailing list Matplotlib-users@= lists.sourceforge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/matplo= tlib-users=0A=0A =0A--=0AJohn Henry=0A=0A |