On Apr 3, 2005, at 4:12 AM, Larry Bugbee wrote:
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
from distutils.core import setup, Extension
setup(
name='arith',
version='1.0',
ext_modules=[
# swig generates arith.py -- so extension is _arith.so
Extension('_arith', ['arith.i', 'arith.c']),
],
)
-bob
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig