Embedded python loading .so files?

jefishman at gmail.com jefishman at gmail.com
Thu Oct 26 00:28:00 EDT 2006


I have a Python (2.3.x) interpreter running embedded in a C++
application  on a host machine.  I would like to run a specific package
on that host machine (numpy).  I have managed to compile
(cross-compile) the library, so that I have the python modules and the
compiled .so files.  I am relatively sure that these would import
normally in a standard interpreter (they give bad magic on the build
machine).

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?  Do I need to load
it through the C API?  I would heavily prefer not to recompile the
interpreter, if at all possible.

Thanks,
Jeremy




More information about the Python-list mailing list