Python embedded - [Won't load dynamic libraries on Linux] - HELP!!

Kim Petersen kp at kyborg.dk
Wed Aug 14 15:42:26 CEST 2002


Gerhard Häring wrote:
> In article <3D57C830.4070909 at kyborg.dk>, Kim Petersen wrote:

>>>
>>>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

All the libraries in that the above faqts reveal are linked with the new 
.so (actually one was missing ieee - but didn't change anything).

>>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?

Hmmm, from what i find all the modules are on the sys.path line:

in CGIX.py PATH: ['/usr/bin', '/var/www/cgi-bin', '/usr/lib/python1.5/', 
'/usr/lib/python1.5/lib-dynload/', '', '/usr/lib/python1.5/', 
'/usr/lib/python1.5/plat-linux-i386', '/usr/lib/python1.5/lib-tk', 
'/usr/lib/python1.5/lib-dynload', '/usr/lib/python1.5/site-packages']

The double paths are because i tried to meddle with the PYTHONPATH 
environment variable.... it still *cannot* find the .so files - how
can i tell?
when importing a module (selfmade) - every import works except for 
things like "import time" (which uses 
/usr/lib/python1.5/lib-dynload/timemodule.so)....


IF i load all the .so's in the python path with the new .so (my embedded 
python interpretor for RM/Cobol) then everything works - BUT will fail 
the moment a distutil install has been done - and someone tries to load 
the new module [of course assuming that the distutil module uses a 
binary module (.so)]

> 
> 
>>- 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.
> 
> Gerhard



-- 
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