<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2800.1642" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff background="">
<DIV><FONT size=2>What is the registry key <FONT
face="Lucida Console">HKLM\Software\Python\PythonCore\2.6\PythonPath</FONT> for?
The docs (http://www.python.org/doc/2.6/using/windows.html) say</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT size=2>Modifying the module search path can also be done through
the Windows registry: Edit <FONT
face="Lucida Console">HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\version\PythonPath</FONT></FONT></DIV>
<DIV><FONT face="Lucida Console" size=2></FONT> </DIV></BLOCKQUOTE>
<DIV><FONT size=2>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:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><EM>Export the value of the key:</EM></FONT></DIV>
<DIV><FONT face="Lucida Console" size=2>C:\>regedit /E xxx
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\PythonPath</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><EM>Display it:</EM></FONT></DIV>
<DIV><FONT face="Lucida Console" size=2>C:\>type xxx</FONT></DIV>
<DIV><FONT face="Lucida Console"><FONT size=2>...</FONT><BR></FONT><FONT
face="Lucida Console" size=2>@="<FONT
color=#808080>F:\\Development\\Python26\\Lib</FONT>;<FONT
color=#000080>F:\\Development\\Python26\\DLLs</FONT>;F:\\Developmen<BR>t\\Python26\\Lib\\lib-tk;F:\\Development\\Python26\\Lib\\site-packages\\win32;F:<BR>\\Development\\Python26\\Lib\\site-packages\\pythonwin;<FONT
color=#800080>c:\\temp</FONT>"</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><EM>Note the temporary addition of <FONT face="Lucida Console"
color=#800080>c:\temp</FONT> to the end of the path. Now ask Python what it
thinks:</EM></FONT></DIV><FONT size=2></FONT>
<DIV><FONT size=2></FONT><BR><FONT size=2><FONT
face="Lucida Console">C:\>python<BR>Python 2.6.4 (r264:75708, Oct 26 2009,
08:23:19) [MSC v.1500 32 bit (Intel)] on<BR>win32<BR>Type "help", "copyright",
"credits" or "license" for more information.<BR>>>> import
sys<BR>>>> sys.path<BR>['', 'C:\\WINNT\\system32\\python26.zip', <FONT
color=#000080>'F:\\Development\\Python26\\DLLs'</FONT>, <FONT
color=#808080>'F:<BR>\\Development\\Python26\\lib'</FONT>, <FONT
color=#008000>'F:\\Development\\Python26\\lib\\plat-win'</FONT>,
'F:\\<BR>Development\\Python26\\lib\\lib-tk', 'F:\\Development\\Python26',
'F:\\Developme<BR>nt\\Python26\\lib\\site-packages',
'F:\\Development\\Python26\\lib\\site-package<BR>s\\win32',
'F:\\Development\\Python26\\lib\\site-packages\\win32\\lib',
'F:\\Dev<BR>elopment\\Python26\\lib\\site-packages\\Pythonwin']<BR>>>><BR></FONT></FONT></DIV><FONT
face="Lucida Console"></FONT>
<DIV><FONT size=2>Not only is <FONT face="Lucida Console"
color=#800080>c:\temp</FONT> not in <FONT face="Lucida Console">sys.path</FONT>,
even the folders that it has in common with the registry entry are in a
different order (eg <FONT face="Lucida Console" color=#000080>DLLs</FONT> and
<FONT face="Lucida Console" color=#808080>lib</FONT>), so it's hard to believe
that the registry entry has any influence at all on <FONT
face="Lucida Console">sys.path</FONT>. Also <FONT
face="Lucida Console">sys.path</FONT> has <FONT face="Lucida Console"
color=#008000>lib\plat-win</FONT> which I think was introduced about Python 1.5
and I think disappeared again about Python 2.0.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>So, why is that registry key there at all? And
why does <FONT face="Lucida Console">sys.path</FONT> have the
nonexistent <FONT face="Lucida Console" color=#008000>plat-win</FONT> in
it, even in Python 3.0? Is it just historical baggage? </FONT></DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I would like to see the registry key once again working
as advertised. I know I can set the <FONT
face="Lucida Console">pythonpath</FONT> 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 <FONT
face="Lucida Console">Software\Python</FONT>, not in <FONT
face="Lucida Console">System\CurrentControlSet</FONT>. </FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>If the registry key turned out to be a bad idea, it would
be illuminating to know why.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>--<BR>Paul Keating<BR>The Hague</FONT></DIV></BODY></HTML>