Embedded python loading .so files?

"Martin v. Löwis" martin at v.loewis.de
Thu Oct 26 01:18:42 EDT 2006


jefishman at gmail.com schrieb:
> However, I would like to be able to import this package dynamically
> within the application running on the host machine.  When I attempted
> to import the package within the already loaded python modules, I would
> get errors that the C portions of the package could not be found (the
> pure-python modules would load, call to import module_foo, which is
> module_foo.so, but would error "Cannot find module_foo").
> 
> How can I get the application to load the package?

You really need to do some debugging here. There must be more error
message than that, or there are some issues with libdl on the target
system. A common problem is that it gives an error message that
some symbols could not be found when loading the shared library,
and that these symbols originate from Python run-time. In this
case, the reason is that the executable does not export the Python
symbols; you need to pass -export-dynamic to the linker of the
container application.

This is all guessing, of course: you didn't even say whether
the target system is Unixish-ELF-based.

Regards,
Martin



More information about the Python-list mailing list