[cairo] Cannot import PyCairo in Python 3.0 (ImportError: dlopen / "Expected in: flat namespace")

Gerdus van Zyl gerdusvanzyl at gmail.com
Sun Jan 4 10:21:56 PST 2009


At the very least you will need to compile pycairo/cairo yourself and
pycairo against py3k. It's a fairly straightforward binding so errors
should be fixable. That being said it won't be trivial. Any reason why
you are moving to Python 3.0 so fast? Since it's a breaking release
expect a few years before everything ported.

~G

On Sun, Jan 4, 2009 at 6:56 PM, Philipp Schumann <phil at roxority.com> wrote:
> Hello,
>
> I'm in the process of moving my code base to Python 3.0. On Mac OS X
> 10.5.6, I've upgraded both Cairo and PyCairo to 1.8.0; then in /
> Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/site-
> packages/ ran 2to3 -w cairo and removed the __init__.pyc file.
>
> After restarting Eclipse Ganimede /w Pydev and trying to run my code,
> I got the following ImportError:
>
>   File "/Users/roxor/dev-py/metaleap/src/metaleap/core/gfx.py", line
> 2, in <module>
>     import cairo
>   File "/Library/Frameworks/Python.framework/Versions/3.0/lib/
> python3.0/site-packages/cairo/__init__.py", line 1, in <module>
>     from ._cairo import *
> ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.0/
> lib/python3.0/site-packages/cairo/_cairo.so, 2): Symbol not found:
> __Py_ZeroStruct
>   Referenced from: /Library/Frameworks/Python.framework/Versions/3.0/
> lib/python3.0/site-packages/cairo/_cairo.so
>   Expected in: flat namespace
>
> Any ideas how this can be fixed "quick-and-dirty"-ish? I'm far from a
> production release anyway so I don't have to wait until pycairo
> "officially" supports Python 3000. Just any ideas to quickly and
> easily get Python 3.0 / pycairo to work with the current _cairo.so
> dynamic library would be *highly* appreciated...
>
> Thanks a lot,
> Phil
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list