Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SWIG/Python2.4.1: "ImportError: dynamic module does not define init function (initSHIP)"

Reply
Thread Tools

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

 
 
Bill Davy
Guest
Posts: n/a
 
      05-04-2005
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:

>>> import SHIP


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.


 
Reply With Quote
 
 
 
 
myk_raniu myk_raniu is offline
Junior Member
Join Date: Jun 2009
Posts: 1
 
      06-24-2009
Try something like this in the .i file

%module SHIP

%{
#define #define SWIG_FILE_WITH_INIT
...
#include headers etc
...
%}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic module does not define init function (initpsycopgmodule) kickslop Python 1 03-29-2007 04:50 PM
SWIG/IDLE/Python: F5 SHIP.py works but "import SHIP" gives "ImportError: dynamic module does not define init function (initSHIP)" Bill Davy Python 0 05-12-2005 08:48 AM
ImportError: dynamic module does not define init function(initmymodule) Balaji Python 1 08-12-2004 11:08 AM
c extension works in Linux but not Windows==>?? ImportError: dynamic module does not define init function (initpeak_load) Christian Seberino Python 2 02-12-2004 10:08 PM
py2exe: dynamic module does not define init function Alessandro Crugnola *sephiroth* Python 6 09-22-2003 04:16 PM



Advertisments