What is the registry key HKLM\Software\Python\PythonCore\2.6\PythonPath for? 
The docs (http://www.python.org/doc/2.6/using/windows.html) say

  Modifying the module search path can also be done through the Windows 
registry: Edit HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\version\PythonPath

but this doesn't work. Judging by what I see in the registries of old servers 
at my site, I think it must have worked in Python 1.5, but it doesn't now, as 
the following shows:

Export the value of the key:
C:\>regedit /E  xxx  
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\PythonPath

Display it:
C:\>type xxx
...
@="F:\\Development\\Python26\\Lib;F:\\Development\\Python26\\DLLs;F:\\Developmen
t\\Python26\\Lib\\lib-tk;F:\\Development\\Python26\\Lib\\site-packages\\win32;F:
\\Development\\Python26\\Lib\\site-packages\\pythonwin;c:\\temp"

Note the temporary addition of c:\temp to the end of the path. Now ask Python 
what it thinks:

C:\>python
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\WINNT\\system32\\python26.zip', 'F:\\Development\\Python26\\DLLs', 'F:
\\Development\\Python26\\lib', 'F:\\Development\\Python26\\lib\\plat-win', 'F:\\
Development\\Python26\\lib\\lib-tk', 'F:\\Development\\Python26', 'F:\\Developme
nt\\Python26\\lib\\site-packages', 'F:\\Development\\Python26\\lib\\site-package
s\\win32', 'F:\\Development\\Python26\\lib\\site-packages\\win32\\lib', 'F:\\Dev
elopment\\Python26\\lib\\site-packages\\Pythonwin']
>>>

Not only is c:\temp not in sys.path, even the folders that it has in common 
with the registry entry are in a different order (eg DLLs and lib), so it's 
hard to believe that the registry entry has any influence at all on sys.path. 
Also sys.path has lib\plat-win which I think was introduced about Python 1.5 
and I think disappeared again about Python 2.0.

So, why is that registry key there at all? And why does sys.path have the 
nonexistent plat-win in it, even in Python 3.0? Is it just historical baggage? 

I would like to see the registry key once again working as advertised. I know I 
can set the pythonpath environment variable, and I also know that environment 
variables just live in another registry key, but changing that key strikes me 
as inelegant. Python stuff should live in Software\Python, not in 
System\CurrentControlSet. 

If the registry key turned out to be a bad idea, it would be illuminating to 
know why.

--
Paul Keating
The Hague
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to