Python embedded - linking problem on Linux - trying again

Gerhard Häring gerhard.haering at
Mon Aug 12 11:07:25 EDT 2002

In article <3D57C830.4070909 at>, Kim Petersen wrote:
> Gerhard Häring wrote:
>> In article <3D57BD22.8090305 at>, 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?
> 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
> _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?

> - 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 Häring
OPUS GmbH München
Tel.: +49 89 - 889 49 7 - 32

More information about the Python-list mailing list