[cairo] PyCairo crashes
Steve
stevech1097 at yahoo.com.au
Tue Nov 17 23:25:55 PST 2009
On Tue, 2009-11-17 at 13:11 -0500, Michael Droettboom wrote:
> Steve wrote:
> > On Tue, 2009-11-17 at 03:12 -0800, cairo-request at cairographics.org
> > wrote:
> >
> >> On Mon, 16 Nov 2009 16:49:42 +0100, Simon B?chler <sbaechler at me.com>
> >> wrote:
> >>
> >>> self.basename=self.basename.decode("unicode_escape","ignore")
> >>> self.basename=self.basename.encode("ascii","ignore")
> >>>
> >>> self.surface2.write_to_png(self.basename)
> >>>
> >>> Now special characters are just left out which is sad. Apparently
> >>>
> >> the
> >>
> >>> function cannot deal with those.
> >>>
> If you have a Unicode path, and are sending it to a function that takes
> only strings, you generally want to do:
>
> path.encode(sys.getfilesystemencoding())
>
> which do the right thing to encode the path into something the low-level
> C "fopen" can understand.
>
> One could argue it might be more "Pythonic" for PyCairo to handle that
> conversion internally, but hopefully the above is the correct workaround.
>
> Mike
That looks like a useful function to know, thanks for the tip.
Steve
More information about the cairo
mailing list