swig-python import error

abarun22 at gmail.com abarun22 at gmail.com
Fri Mar 7 16:44:19 CET 2008

I am facing a problem while loading a SWIG generated shared module
from python. The development is under HP-UX 32b platform. I use gcc
version 4.0.2 to build the shared module.  This is how i try to build
the module.

# Compilation
GCC="$GCC -march=1.1"
$GCC -v -c -fpic ${ETUDE}.c ${ETUDE}_wrap.c -DDOUBLE_PRECISION -

# linking
ld -b binary -g -shared ${ETUDE}.o ${ETUDE}_wrap.o -o _${ETUDE}.so \
-a archive ${LIBS_CHAINE_PATH} -lfichiers_r8 -lmem -lutilitaires -
lsysteme -lcalcul -lmsgml -lcaractere \
-rpath -L/michprojects/ef/deli/Working/Source/deli9-PYAPI/Sandbox/libs/
chaine/PYAPI/don -L/michprojects/ef/deli/Working/Source/deli9-PYAPI/

The module generated is called _don.so. In addition to that i set the
module path in LD_LIBRARY_PATH environment variable. Th error looks
like as follows.

Import error: module cannot be loaded.

But i am wondering how i am getting import error although every thing
looks OK. Any ideas are most welcome and thanks in advance.

More information about the Python-list mailing list