I had earlier written an application which embedded Python and which
worked fine. After an upgrade to python 2.1.1 the program started to
fail. In an attempt to debug it, I started from scratch, using the
example code of a minimalist program that embeds Python, taken from the
'Linux Programming' book:

----------------------- mypy.c --------------
#include <stdio.h>

#include "Python.h"

int main(int argc, char *argv[])
int rc;

PySys_SetArgv(argc, argv);
rc = PyRun_AnyFile(stdin, "???");

return rc;

I compile and link it like this:

gcc -c -I/usr/include/python2.1 mypy.c
gcc -o mypy mypy.o /usr/lib/python2.1/config/libpython2.1.a \
-ldl -lutil -lpthread -lieee -lm

When I run it, I can enter Python code interactively as expected. Importing
modules like 'sys' and 'string' and using them works fine, but when I do
'import Numeric' I get

Traceback (most recent call last):
File "???", line 1, in ?
File "/usr/lib/python2.1/site-packages/Numeric/Numeric.py", line 86, in ?
import multiarray
ImportError: /usr/lib/python2.1/site-packages/Numeric/multiarray.so:
undefined symbol: PyInt_FromLong

So obviously there is a problem to dynamically resolve entry points in
the Numeric module. The Numeric module works just fine when I use it with
Python directly. I have no idea what's going on here. Could someone let me
know how to proceed?


Michael Olberg | e-mail: olberg at oso.chalmers.se
Onsala Space Observatory | tel: +46-31-7725507 (work) +46-300-10778 (home)
S-43992 Onsala, SWEDEN | fax: +46-31-7725590
-------------------- This quote left blank intentionally ------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
postedOct 21, '02 at 7:20a
activeOct 21, '02 at 7:20a

1 user in discussion

Michael Olberg: 1 post



site design / logo © 2022 Grokbase