SystemError: _PyImport_FixupExtension: module _types not loaded

Gabriel Genellina gagsl-py at yahoo.com.ar
Mon Feb 12 17:25:31 EST 2007


En Mon, 12 Feb 2007 15:44:36 -0300, <usenet1 at ingfamily.net> escribió:

> I'm trying to write some "C" code that will run a python script that
> can in turn call some "C" functions.  However I'm having a problem
> getting started because although I can run a script from the python
> ide that imports ctypes, when I execute that 'import ctypes' code from
> the "C" code I get the following error:
>
> 'import site' failed; use -v for traceback

You have to fix this first. Probably you can't import anything, not just  
ctypes.
Quoting myself from a similar problem:

Try this:
PyRun_SimpleString("import sys; print sys.path");
to see where Python expects to find its library (or call the Py_GetPath  
function).
You may need to call Py_SetProgramName (before Py_Initialize) so it can  
find where the standard library resides.
At least for testing purposes, you can copy your executable into the same  
directory where Python is installed.

-- 
Gabriel Genellina




More information about the Python-list mailing list