Re: Dynamic module not initialized properly

Simon Sapin <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Le 10/05/2013 22:46, Vincent de Vos a écrit :
> After building pycairo using GNU Make (I did not use the WAF installer
> because it kept building with errors:
> http://lists.cairographics.org/archives/cairo/2013-May/024295.html)
> .
> configure --prefix=/home/vdevos/pycairo
> make
> make install
>
> It is now included in my PYTHON_PATH using:
> export PYTHONPATH=/home/vdevos/pycairo/lib/python2.6/site-packages/cairo
>
> Then when I open python2.6 on my console and try to import the _cairo
> module I get the following error...
>
> Python 2.6.4 (r264:75706, Dec  5 2009, 21:18:28)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import _cairo
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> SystemError: dynamic module not initialized properly
>
> Does anyone have an idea how to fix this?

Hi,

The _cairo.so file is made to be imported (implicitly) as "cairo._cairo" 
as its Python name. But it’s really an implementation detail. You should 
also have an __init__.py file next to it that contains something like 
"from ._cairo import *" (Note that this is a relative import.)

You’re not supposed to have …/site-packages/cairo in your PYTHONPATH. 
"import cairo" should instead import the cairo/__init__.py file, which 
in turn imports cairo._cairo.

Cheers,
-- 
Simon Sapin
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.