[Pythonmac-SIG] distutils/swig - Loaded module does not contain symbol...

Larry Bugbee bugbee at seanet.com
Sun Apr 3 10:12:52 CEST 2005


I'm stuck.  I'm trying to make a Python extension from some relatively 
simple code written in C.  I created a setup.py and built the module.  
Upon importing, I keep getting an ImportError.  I built and got the 
same error with both python 2.3 and 2.4.1.  (I am running 10.3.8.  swig 
is 1.3.24.  gcc is 3.3.)

Going back to basics I created an even simpler test case with the same 
results.

arith.c
=======
int add(int a, int b) {
		return a+b;
}

arith.i
=======
%module arith
int add(int a, int b);

setup.py
========
import distutils
from distutils.core import setup, Extension
setup(name = 'arith',
       version = '1.0',
       ext_modules = [Extension('arith', ['arith.i', 'arith.c'])])


python setup.py install
 >>>import arith

The error message...

   ImportError: Loaded module does not contain symbol _initarith

Perhaps you have a suggestion?

Tx, Larry



More information about the Pythonmac-SIG mailing list