On Dec 7, 2:01 pm, DavidM <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm embedding python in a C prog which is built as a linux shared lib. > > The prog is linked against libpython, and on startup, it calls > Py_Initialize(). > > The prog imports a pure-python script. The script starts up ok, but when > it imports the 'math' module, the import fails with: > > Traceback (most recent call last): > File "/home/david/work/video/myprogs/dvedit/test/frei0rfx1.py", line 10, in > <module> > import math > ImportError: /usr/lib/python2.5/lib-dynload/math.so: undefined symbol: > PyExc_ValueError > Failed to import math > > Any ideas of how to work around this? > > Please note - the program I'm writing *must* be built as a shared lib, so > the usual practice of 'extend, don't embed' is just not an option here. > > Thoughts? > > Cheers > D
the math module above is failing to load because of: "undefined symbol: PyExc_ValueError" You may have to import some other module before loading math. Try doing nm on libraries in /usr/lib/python2.5/lib-dynload & see which one has this symbol (a function) in defined state ("T"). Also, verify if your script works fine out of the C program - may be at python prompt. -- http://mail.python.org/mailman/listinfo/python-list