[capi-sig] 回复 :Re: Some problem when i use Python C/API to embed python script, need Help......

zouxianjun 45728 zouxianjun at huawei.com
Thu Jan 22 09:00:06 CET 2009

Thank you very much!!I resolved the problem after i install the new version Python(2.6.1).After i installed the new version, i check the binascii.so again, ldd -r binascii.so, everything goes right.... thank you very much.....

 This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained here in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email
 immediately and delete it!

----- 原邮件 -----
发件人: Jack Jansen <Jack.Jansen at cwi.nl>
日期: 星期三, 一月 7日, 2009 上午5:07
主题: Re: [capi-sig] Some problem when i use Python C/API to embed python script, need Help......
收件人: zouxianjun 45728 <zouxianjun at huawei.com>
抄送: capi-sig at python.org

> 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