embedded python pythonpath

Furkan Kuru furkankuru at gmail.com
Tue Mar 25 18:01:09 EDT 2008


Hello,
It is somehow related with c++ and python.

I've tried below code (Setting pythonpath environment variable)
and then initialize python interpreter but the embedded python interpreter
did not get the newly assigned PYTHONPATH.
I ve looked at the sys.path in python code (that is run by the embedded
interpreter) and it behaved according to older pythonpath.

Setting environment variable seemed to be correct.
Does py_initialize run in another thread so it starts before setting the
environment var?

// add custom plib.zip archive to pythonpath

if(!::getenv("PYTHONPATH"))

{

::putenv(
"PYTHONPATH=.;.\\plib.zip");

}

else ::putenv("PYTHONPATH=%PYTHONPATH%;.\\plib.zip");

std::cout <<
"PYTHONPath Set to: " << ::getenv("PYTHONPATH") << std::endl << "And Again:
";

system("echo %PYTHONPATH%");

Py_Initialize();

Sorry for asking it twice.

Regards,



-- 
Furkan Kuru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080326/a248a905/attachment.html>


More information about the Python-list mailing list