SWIG: ImportError: dynamic module does not define init function

Ignacio Vazquez-Abrams ignacio at openservices.net
Sun Sep 16 23:37:39 EDT 2001


On Sun, 16 Sep 2001, Louis Luangkesorn wrote:

> I'm trying to run the example from the SWIG User's Guide (V 1.1 June 23,
> 1997)  When I try to load the example I get the following:
>
> PythonWin 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on
> win32.
> Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) - see
> 'Help/About PythonWin' for further copyright information.
> >>> import sys
> >>> sys.path.append('c:\lluang\gmcode\cnumint\debug')
> >>> import cnumint
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> ImportError: dynamic module does not define init function (initcnumint)
> >>>
>
> I've noticed on various mailing lists several people have asked this
> same question, but I have not seen anyone respond to this.  Is there
> something I'm missing?  Thanks.

It's really quite simple. Your C code is missing the init<modulename>()
function which is responsible for actually setting up the module for use. Take
a look at the modules that come with Python for examples on how it should be
implemented.

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list