weird embedding problem

Graham Dumpleton Graham.Dumpleton at gmail.com
Fri Dec 7 03:53:15 EST 2007


On Dec 7, 5:01 pm, DavidM <nos... at nowhere.com> 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?

Are you actually linking your C program against the Python library?

Graham




More information about the Python-list mailing list