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

Philipp Schumann phil at roxority.com
Sun Jan 4 08:56:46 PST 2009


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 / 
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:  
   Referenced from: /Library/Frameworks/Python.framework/Versions/3.0/ 
   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,

More information about the cairo mailing list