Message164691
> Joshua, if you are embedding Python, why don't you simply call Py_SetPath to set the search path appropriately? Or is it not enough? (I've lost memory of the mazy details of how we calculate paths :-S).
Setting Py_SetPath manually would basically require me to replicate the work done in Modules/getpath.c to figure out where the python libraries are. I already set PYTHONPATH to get it to find my own modules. (Note that there is a big difference between setting PYTHONPATH the environmental variable and calling Py_SetPath, Py_SetPath assumes that you are setting the python library module paths as well.)
The basic problem is that in function calculate_path (inside of Modules/getpath.c ) it has the following code:
char *_path = getenv("PATH");
...
wchar_t *prog = Py_GetProgramName();
...
while (1) {
...
joinpath(progpath, prog);
if (isxfile(progpath))
break;
...
which goes through the path and tries to find an executable with the same name as returned by Py_GetProgramName()
So if I do a """Py_SetProgramName(L"python3");""" that method works because prog="python3" but if I don't then the method fails because prog="python".
Basically, to fix this bug, somehow, "wchar_t *prog =" in calculate_path needs to get the actual python executable for this version of python. |
|
Date |
User |
Action |
Args |
2012-07-05 18:53:41 | Joshua.Cogliati | set | recipients:
+ Joshua.Cogliati, loewis, georg.brandl, pitrou, benjamin.peterson, eric.araujo, Arfrever |
2012-07-05 18:53:41 | Joshua.Cogliati | set | messageid: <1341514421.21.0.770989866581.issue15020@psf.upfronthosting.co.za> |
2012-07-05 18:53:40 | Joshua.Cogliati | link | issue15020 messages |
2012-07-05 18:53:40 | Joshua.Cogliati | create | |
|