I have the error: "SystemError: dynamic module not initialized properly" I guess this is due to the fact that the initialized module's name is not the same as the init function.
I tried this:
m2 = Py_InitModule("sf", module_methods);
I renamed the init function initsf.
Then in setup.py, I replaced
ext_modules=[ Extension('PySFML',
by
ext_modules=[ Extension('PySFML.sf',
It created the library as sf.so, under the PySFML directory.
Then I created a directory called PySFML, created an __init__.py file in it,
in which I put:
from sf import *
I added in setup.py:
package_dir = {'PySFML':'PySFML'},
packages=['PySFML'],
so he copied __init__.py in the same directory as sf.so.
Now it works like I wanted it to work.
This is currently the only working solution I found.
On Dec 29, 2007 6:59 PM, Gustavo Carneiro gjcarneiro@gmail.com wrote:
On 29/12/2007, Remi K. remi.k2620@gmail.com wrote:
Hi everybody, I have two modules: m1 = Py_InitModule3("PySFML", NULL, "Python binding for sfml (Simple Fast Media Library)");
m2 = Py_InitModule("sf", module_methods);
Try this:
m2 = Py_InitModule("PySFML.sf", module_methods);
Then I add a few classes, like Color, to m2.
Then I make the first module contain the second one:
PyModule_AddObject(m1, "sf", m2);
That is not needed.
-- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert