[cairo] File objects in pycairo

My Th rei4dan at gmail.com
Tue Aug 10 06:53:28 PDT 2010


Documentation of pycairo says that PDFSurface accepts as an argument a
string or writable file object, but with file objects it doesn't work in
all cases. The same is the case for write_to_png(). It works on Linux,
but on Windows it doesn't always work.

I'm using it like this:
f = open(filename, 'w')
surf = cairo.PSSurface(f, w, h)

I'm not closing f explicitly, I think pycairo should do that.

Is this a bug in pycairo, or is this a problem in my usage of it? Any
suggestions are very appreciated.

I have installed pycairo 1.8.6 for Python 2.6 and using Cairo DLLs from
the gtk+ bundle 2.20:


More information about the cairo mailing list