Problem embedding the Python interpreter and importing win32extensions

Gabriel Genellina gagsl-py at yahoo.com.ar
Fri Jan 26 22:33:54 EST 2007


<paroutyj at gdls.com> escribió en el mensaje 
news:OF3B0F680E.702A5F55-ON8525726F.0065766F-8525726F.0066AF6D at is002023.gdls.com...

> I am using python 2.2.3, because I am using some dSpace software
> (controldesk/automationdesk) that is based upon that version of python. I
> have some pre-compiled python modules that come with the dspace
> applications. I am pretty sure that those modules use win32com or
> pythoncom. I want to use those modules from a C/C++ application or DLL via
> an embedded interpreter. I can make it work, but it only works once. I get
> an error trying to import those modules again, even after uninitializing
> the interpreter (Py_Initialize) and re-initializing it (Py_Uninitialize).
> I thought may be using a new sub-interpreter would help but it doesn't so
> now I have no idea what I could try. Any ideas?

Unfortunately there is no way to uninitialize an extension module (no 
"unload(module)" exists). So Py_Uninitialize doesn't fully reset the 
environment. Try to avoid that, initialize the interpreter just once, and 
uninitialize it only at the end of the application.

-- 
Gabriel Genellina 





More information about the Python-list mailing list