ImportError in embedded Python Interpreter

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jan 30 11:09:21 CET 2009


En Fri, 30 Jan 2009 06:54:56 -0200, <googler.1.webmaster at spamgourmet.com>  
escribió:

> Thanks. Well, os.py is found and all the others which don't need a
> library.
> I tested this:
>
> I execute Py_Main(...) in my app which executes the console
> interpreter and
> i tried to execute "import socket" which works.
>
> So Py_Main has something what my created PyRun_SimpleString doesn't
> have.
> Maybe the environment variables? Something has to be called in Py_Main
> which I should call, too.

(I assume you moved the executable to another directory - in your first  
post, your app was in some place, and python.exe/python25.dll in another)

Py_Main, apart from processing arguments and some stuff related to the  
interactive mode, doesn't do much; a stripped down version would be:

Py_SetProgramName(argv[0]);
Py_Initialize();
PySys_SetArgv(...);
PyRun_AnyFileExFlags(fd, filename, ...)
WaitForThreadShutdown();
Py_Finalize();

-- 
Gabriel Genellina




More information about the Python-list mailing list