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

Discussion in 'Python' started by Bill Davy, May 4, 2005.

  1. Bill Davy

    Bill Davy Guest

    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.
     
    Bill Davy, May 4, 2005
    #1
    1. Advertising

  2. Bill Davy

    myk_raniu

    Joined:
    Jun 24, 2009
    Messages:
    1
    Try something like this in the .i file

    %module SHIP

    %{
    #define #define SWIG_FILE_WITH_INIT
    ...
    #include headers etc
    ...
    %}
     
    myk_raniu, Jun 24, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xavier
    Replies:
    0
    Views:
    451
    Xavier
    Aug 6, 2003
  2. Skip Montanaro
    Replies:
    1
    Views:
    458
    Thomas Heller
    Aug 7, 2003
  3. snacktime
    Replies:
    13
    Views:
    586
    Dan Sommers
    Feb 22, 2005
  4. Uwe Mayer

    changing from python2.3 to python2.4

    Uwe Mayer, Apr 8, 2005, in forum: Python
    Replies:
    1
    Views:
    322
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Apr 9, 2005
  5. Ksenia Marasanova
    Replies:
    2
    Views:
    371
    Mike Meyer
    Nov 17, 2005
Loading...

Share This Page