[cairo] PyCairo crashes

Steve stevech1097 at yahoo.com.au
Tue Nov 17 05:30:05 PST 2009


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.

You originally said self.basename was a string, but its now looking like
you are using unicode objects.

> Strange. The underlying C function:
> 
>         cairo_surface_write_to_png (cairo_surface_t     *surface,
>                                     const char          *filename)
> 
> Takes that filename and just calls:
> 
>         FILE *fp = fopen (filename, "wb");
> 
> So that should work with pretty much any sequence of bytes you like
> for
> the filename, (as long as it doesn't contain '/' of course).
> 
> So perhaps there's a bug somewhere in the python wrapper for this
> function.

Probably. If Simon can state exactly what string or unicode object he is
using which is giving the problems it will make it much easier to find
the problem.

Regards
Steve




More information about the cairo mailing list