[cairo] PyCairo crashes

Simon Bächler sbaechler at me.com
Sat Nov 14 16:36:04 PST 2009


Hi

I'm experiencing a strange crash using PyCairo. I have tried different 
version of PyCairo and Cairo. The most recent ones were Pycairo 1.8.9 
and Cairo 1.9.2.

When I execute the code Python crashes. Always.

The function that causes the crash is surface2.write_to_png(self.basename).
When I replace self.basename with a string such as "output.png" it 
works. Even though self.basename is a string as well.


Here is a code snippet:

self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, self.width, 
self.width)
cr= self.cr = cairo.Context(self.surface)
cr.scale(self.width, self.width)

os.chdir(self.dirname)

stride = cairo.ImageSurface.format_stride_for_width 
(cairo.FORMAT_ARGB32, self.width)   
self.surface2 = cairo.ImageSurface.create_for_data(self.surface, 
cairo.FORMAT_ARGB32, self.width, self.height, stride)
self.surface2.write_to_png(self.basename)


Regards
Simon




More information about the cairo mailing list