Make sure you are not mixing Python versions. In Python version 2, the init function was called Init_, and in version 3 this function is called PyInit _
In my case, this happened when SWIG 3.0.2 used Python 3.4 to create bindings, while my Python IDE was called the Python 2.7 interpreter.
You can see the difference in the generated .cxx file:
#if PY_VERSION_HEX >= 0x03000000 # define SWIG_init PyInit__<modulename> #else # define SWIG_init init_<modulename> #endif
On linux, you can also use the following command to test .so export:
nm -D <modulename> | grep <modulename>
This will give you the name of the init function inside your library.
Klaas
source share