Joshua Cogliati <jrinc...@gmail.com> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15020>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to