On Feb 12, 2:25 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 12 Feb 2007 15:44:36 -0300, <[EMAIL PROTECTED]> 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
This is what I get: 'import site' failed; use -v for traceback ['c:\\temp\\pytest\\Debug\\python25_d.zip', 'C:\\Python25\\Lib', 'C:\ \Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', '', 'c:\\temp\\pytest\ \Debug'] In fact, the 'import site' failed; use -v for traceback happens when I call the Py_Initialize(). As can be seen from the output, the import sys; and print sys.path works. I also added Py_SetProgramName(argv[0]) before calling PyInitialize() but there was no change. Thanks, Steve -- http://mail.python.org/mailman/listinfo/python-list