Out of memory on surface finish
In python 3.8, windows 10 x64, pycairo 1.20.1:
import cairo
with cairo.PDFSurface("example2.pdf", 200, 200) as surface:
pass
surface = cairo.PDFSurface("example.pdf", 200, 200)
surface.finish()
The call with the context manager works, but the last line surface finish throws an out of memory error. This is now only possible to use the surface within the context manager for some reason ?
Does anyone have the same issue ?
Thank you
Everything is working with these builds:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo
Got exactly the same thing. Windows 10 64-bit, Python 3.9.1, pycairo 1.21.0.
I also noticed the following crashes likewise (with cairo.MemoryError: out of memory at the show_page() call):
import cairo
with cairo.PDFSurface("test.pdf", 200, 200) as surface:
cairo.Context(surface).show_page()
Basically pycairo is unusable for me here.
Everything is working with these builds:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo
Worked with the build found here, many thanks (this .whl collection has saved my skin quite a few times before). But the PyPI version remains entirely useless.
Everything is working with these builds:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo
@eleroy you're a champ. This solution really just saved me hours worth of headaches.
Yeah, I can reproduce the error. On the packages version of Cairo on PyPI, I found the Cairo version bundled to be
>>> import cairo
>>> cairo.cairo_version()
11702
and on the wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo, it's
>>> import cairo
>>> cairo.cairo_version()
11600
So it must be something with the version of the library used. Also, the most recent version is 1.17.6 (developmental release) and I'll try and see if I can reproduce it there. I should also work on https://github.com/pygobject/pycairo/pull/243 someday. Edit: No I can't reproduce with wheels built with recent version 1.17.6
>>> import cairo
>>> cairo.cairo_version()
11706
>>> surface = cairo.PDFSurface("example.pdf", 200, 200)
>>> surface.finish()
I can reproduce the issue with 1.22.0, but with 1.23.0, which includes the new cairo build everything seems to work now.
So I think this is fixed in the latest release.
I assumed this was fixed in cairo then.