[capi-sig] Some problem when i use Python C/API to embed python script, need Help......
Jack Jansen
Jack.Jansen at cwi.nl
Tue Jan 6 21:58:10 CET 2009
On 5-Jan-2009, at 08:08 , zouxianjun 45728 wrote:
> when the program run as exe, everything goes right, but if i compile
> the program as a .so lib, use other program to load the .so lib and
> run, it goes wrong,in the lib i also use PyRun_SimpleString("import
> base64"); it goes wrong.....my python version is 2.3, i want to know
> what's the problem...... PyErr_Print() print the error info
> below:
> Traceback (most recent call last):
> File "./myModule111.py", line 3, in ?
> import base64
> File "/usr/lib/python2.3/base64.py", line 7, in ?
> import binascii
> ImportError: /usr/lib/python2.3/lib-dynload/binascii.so: undefined
> symbol: PyExc_TypeError
>
> i check the binascii.so, ldd -r binascii.so, this lib really has
> many undefined symbols include PyExc_TypeError, but the problem is
> when the program is executable, it can goes fine......
>
> when i compile the program as .so lib, i add -Xlinker -export-
> dynamic, it doesn't solve the problem.........
Ah, the joys of dynamic linkers...
You'll need to specify the exact version of your operating system
(probably Linux, but maybe MacOSX or some other unix variant?), and,
for completeness, your compiler and linker version.
Sometimes symbols in the base executable are available to all
dynamically loaded modules, but symbols in modules that are themselves
loaded dynamically not. This seems to be what's biting you.
Oh yes: can you try a newer version of Python? I fixed a similar error
for Python on MacOSX at some point in the past, it could be that
you're looking at an error has been fixed in the mean time, 2.3 is
pretty old by now.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma
Goldman
More information about the capi-sig
mailing list