logo       

newbie: loading' example' example in python: msg#00110

programming.swig

Subject: newbie: loading' example' example in python


Hi All,

using a PIII laptop, debian testing (kernel 2.4.19), python 2.2.1, SWIG
Version 1.3.17u-20030123-0900 (built from source)

following what I believe to be the latest docs (SWIG 1.3.11 (31 January
2002), I tried prepping a previously written C function (chash) for use
in Python with SWIG. After following the instructions, it failed to
import into Python with the error:

Python 2.2.1 (#1, Jul 29 2002, 23:15:49)
...
ImportError: dynamic module does not define init function (initchash)



OK - back to the example code to verify that I'm doing things right -
after going thru the example code in the "Introduction: A SWIG example",
everything builds correctly until I try to load the module into Python,
when I get a similar error:

ImportError: dynamic module does not define init function (initexample)

grepping for 'init' thru the '.so' files I just built, I find:

$ strings example.so |grep init
_init
init_example

and
$ grep -n init example.py example_wrap.c example.i
...
example_wrap.c:643:#define SWIG_init init_example
...

not 'initexample' If I hand-edit the source line to read 'initexample'
and rebuild, the Python error changes to:
SystemError: _PyImport_FixupExtension: module example not loaded

So I'm stuck - is this an error in documentation, in code, or in typing,
or in platform variation?

There's plenty of pages that come back from googling for this error but
nothing that seems to address it in my case besides suggesting that
there is a platform dependency on whther to name the shared code
'example.so' or examplemodule.so'. I've tried both with no change in
result.

Any pointers would be much appreciated.

Harry







--
Cheers, Harry
Harry J Mangalam - 949 856 2847 (v&f) - hjm@xxxxxxxxx
<<plain text preferred>>


--
Cheers, Harry
Harry J Mangalam - 949 856 2847 (v&f) - hjm@xxxxxxxxx
<<plain text preferred>>

_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise