SWIG/Python2.4.1: "ImportError: dynamic module does not define init function (initSHIP)"

B

Bill Davy

Hello,

I am using SWIG-1.3.24 to make an extension (called SHIP) to Python2.4.1 and
then running under IDLE (if that makes any difference) but when I "import
SHIP" I get:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
import SHIP
ImportError: dynamic module does not define init function (initSHIP)
Indeed, SHIP.py does not define an initSHIP. It does have "import _SHIP"

SHIP_wrap.cpp (produced by SWIG) does have init_SHIP (defined to SWIG_init).

It seems to me I should not be editing SHIP.py (as made by SWIG) but it does
seem to be missing something, or am I?

Thanks in advance,

Bill

PS I gave up trying to use IDLE with a locally compiled debug version of
Python - that's for another day (or week), but thanks for the assorted help
I was given.
 
Joined
Jun 24, 2009
Messages
1
Reaction score
0
Try something like this in the .i file

%module SHIP

%{
#define #define SWIG_FILE_WITH_INIT
...
#include headers etc
...
%}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top