[Python-bugs-list] [Bug #127722] getpythonregpath fails
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 07 Jan 2001 21:37:45 -0800
Bug #127722, was updated on 2001-Jan-05 21:16
Here is a current snapshot of the bug.
Project: Python
Category: Windows
Status: Open
Resolution: None
Bug Group: Platform-specific
Priority: 5
Submitted by: effbiae
Assigned to : mhammond
Summary: getpythonregpath fails
Details: Hi,
I'm on Win95 (regrettably).
I found that while experimenting with embedding Python in C, I initialized
the interpreter, and got the message:
'import site' failed; use -v for traceback
If I putenv("PYTHONHOME=C:\python20"), this disappears. Also, if I put the
executable in C:\python20, the problem disappears.
Please excuse any stupidity that follows as I am a newby to the windows
registy.
in the file:
Pc\getpathp.c
in the function:
static char *
getpythonregpath(HKEY keyBase, int skipcore)
in the call:
rc = RegQueryInfoKey(newKey, NULL, NULL, NULL, &numKeys, NULL, NULL,
NULL, NULL, &dataSize, NULL, NULL);
numKeys is being set to 0 because in my installation of Python 2.0, the
registry key:
HKEY_LOCAL_MACHINE\\Software\\Python\\PythonCore\\PythonPath\
has no subkeys. It has the 'default' (?) value:
C:\Python20\Lib\plat-win;C:\Python20\Lib;C:\Python20\DLLs;C:\Python20\Lib\lib-tk
(I do not have HKEY_CURRENT_USER\\Software\\Python\\PythonCore\\PythonPath
-- in fact I do not have HKEY_CURRENT_USER\\Software\\Python)
Anyway, it looks like the code assumes 'numKeys > 0', which is not the case
at my run-time.
It appears that the the registry editing part of the installation program
may have changed recently, and this file has not been updated accordingly.
Also, the doco for the Python/C API says that the PATH environment variable
may be examined to locate the python executable, but it appears that in the
Win version of Python2.0, PATH is ignored. Is there a reason why PATH is
not examined in the Win version?
Follow-Ups:
Date: 2001-Jan-07 21:37
By: tim_one
Comment:
Assigned to MarkH cuz he might actually think he knows what the code is
doing <wink..
-------------------------------------------------------
Date: 2001-Jan-07 15:48
By: fdrake
Comment:
Assigned to Tim since this is on Windows.
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=127722&group_id=5470