Problem with embedding Python

Alain alain at antinea.org
Thu Mar 30 08:17:59 EST 2000


	Hi,

	I need to call Python from within a C program. It works well till now
but I've to work with NumPy and I've a problem with the 'import'
function :

[alain at kali embed1]$ cat test2.py
from Numeric import *
print "OK"
[alain at kali embed1]$ python test2.py
OK

***** That's good

[alain at kali embed1]$ cat demo.c
#include "Python.h"
int main(int argc, char* argv[]) {
        Py_SetProgramName(argv[0]);
        Py_Initialize();
        PyRun_SimpleString("from Numeric import *\n");
        PyRun_SimpleString("print \"OK\"\n");
        Py_Exit(0);
}

[alain at kali embed1]$ ./demo
Traceback (innermost last):
  File "<string>", line 1, in ?
  File "/usr/local/lib/python1.5/site-packages/Numeric/Numeric.py", line
6, in ?
    import multiarray
ImportError:
/usr/local/lib/python1.5/site-packages/Numeric/multiarray.so: undefined
symbol: _Py_NoneStruct
OK

***** That's wrong

	Can anybody help me ?

	Best regards, ALain



More information about the Python-list mailing list