Extending and Embedding

Diez B. Roggisch deetsNOSPAM at web.de
Sun Mar 13 10:25:44 EST 2005


Eduardo Rodrigues wrote:

> How can I load a module (written in C as a shared
> library (.so)) through "PyRun_SimpleString"?
> 
> I've tried "from <module> import *", but a got a
> message: ImportError: No module named <module>

You can't do this. You have to either wrap the module - which is possible in
several ways, including hand-written code, pyrex, swig and sip. Maybe even
more, I don't know. 

Or you access it using the module ctypes that allows to invoke arbitrary
methods/funtctions of C-libs. google for it.
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list