PYTHONPATH and embedding python

Idriz SMAILI smaili at tttech.com
Tue Oct 9 06:41:23 EDT 2001


Hi,

I have the following problem:

I have embedded Python in an C++ application. The Python modules are
after freezing integrated in the application and those modules should be
imported as frozen modules. Before I initialize the Python interpreter
I've used the putenv in C code to set the environment variable
PYTHONPATH to "pwd == .". I've used the getenv function to check if the
environment variable has been changed and it is as expected really
changed to the new setting result. The problem is that the Python
Interpreter during its initialization uses the same getenv function and
it gets the old value of the PYTHONPATH value. This is my problem,
because I've got a lot of problems in case the user has installed a
different python version, because the Python Interpreter tries to import
for example the os module, which is different between Python 1.5.2 and
Python 2.1.1. I am using Python 2.1.1 and Microsoft Visual Studio V.
6.0. under WinNT operating system.

Does anyone have any suggestions?  Thanks.
Idriz




More information about the Python-list mailing list