Python embedded - linking problem on Linux - trying again

Kim Petersen kp at kyborg.dk
Tue Aug 13 08:23:20 CEST 2002


Gerhard Häring wrote:
> In article <3D57C830.4070909 at kyborg.dk>, Kim Petersen wrote:
> 
>>Gerhard Häring wrote:
>>
>>>In article <3D57BD22.8090305 at kyborg.dk>, Kim Petersen wrote:
>>>
>>>
>>>>When creating an embedded python in an RM/Cobol-85 interpretor, i have the
>>>>following problem:
>>>>
>>>>It seems that i have to link all the modules (the .so's) that i need with the
>>>>new dynamic link library, isn't it at all possible to make it (the python
>>>>embedded interpretor) just find the .so's like the regular interpretor does?
>>>
>>>
>>>What is your problem?
>>>
>>>If it is finding which libraries to link against when embedding Python, does
>>>this FAQTS entry help?
>>>
>>>http://www.faqts.com/knowledge_base/view.phtml/aid/11864/fid/606
>>
>>unfortunatly not ;(
>>
>>My problem is that i'm embedding - not extending.
> 
> 
> And that's what my answer in the FAQTs entry refers to, it was only for the
> wrong question ;-)
> 
> 
>>And when doing so, i miss the references to the dynamic linked modules (like
>>_tkinter.so) _unless_ i specifically link them with the new .so (the embedded
>>interpretor)
> 
> 
> Erh. Most probably that's not the case. It's just that modules like aren't
> found, right?

probably - i haven't thought that way around ;-) But i still have 
trouble grasping this .... if python can find /usr/lib/python<version>/ 
+ /site-packages/ - when importing standard .py[c] - then why isn't it 
capable of finding the .so's ???? In fact what really makes this strange 
(for me) is that it can find my postgresql import (pgdb.py) but cannot 
find the _pg.so which is located in the same directory .../site-packages/

> 
> 
>>- from my point of view i cannot understand why the embedded python doesn't
>>look at the running standard interpretors path and setup - and use those
>>modules (just like it does with the .py[c] modules.....
> 
> 
> There is no magic to it, just do the same as the Python interpreter does :-) I
> only ever used embedding for debugging my extension modules, and just added the
> releveant directories in my PYTHONPATH environment variable. If you don't mind
> hacks, you can always modify your sys.path appropriately from your main app.
> AFAIR pythonrun.c is the right place to look at for insight.

Hmm - i thought i followed the instructions on setting up the 
interpretor by the book - but i must have overlooked something then, 
i'll look through pythonrun.c when i get time (prolly first late today 
or start tomorrow - real life is pressurring on other things ;-)

> 
> Gerhard

Thank you so far.




-- 
Med Venlig Hilsen / Regards

Kim Petersen - Kyborg A/S
IT - Innovationshuset
Havnepladsen 2
7100 Vejle
Tlf. +4576408183 || Fax. +4576408188




More information about the Python-list mailing list