What's before site.py that initializes sys.path
Emile van Sebille
emile at fenx.com
Thu May 27 09:49:37 EDT 1999
I've found the source of my duplicate by virtue of case sys.path entries
under Win9x. I found PythonPath referenced in the install.log :
RegDB Key: Software\Python\PythonCore\1.5\PythonPath
RegDB Val: D:\Program Files\Python\Lib\plat-win;D:\Program
Files\Python\Lib;D:\Program Files\Python\DLLs;D:\Program
Files\Python\Lib\lib-tk
After clearing the value using regedit, I now get:
[Windows 95] D:\Program Files\Python>python
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> for i in sys.path : i
...
''
'D:\\PROGRAM FILES\\PYTHON\\DLLs'
'D:\\PROGRAM FILES\\PYTHON\\lib'
'D:\\PROGRAM FILES\\PYTHON\\lib\\plat-win'
'D:\\PROGRAM FILES\\PYTHON\\lib\\lib-tk'
'D:\\PROGRAM FILES\\PYTHON'
>>>
I've got a residual path problem with Idle, but I haven't dug into that yet:
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> for i in sys.path : i
'D:\\Program Files\\Python\\Tools\\idle'
'D:\\PROGRA~1\\PYTHON\\TOOLS\\IDLE'
'D:\\PROGRAM FILES\\PYTHON\\DLLs'
'D:\\PROGRAM FILES\\PYTHON\\lib'
'D:\\PROGRAM FILES\\PYTHON\\lib\\plat-win'
'D:\\PROGRAM FILES\\PYTHON\\lib\\lib-tk'
'D:\\PROGRAM FILES\\PYTHON'
>>>
I don't have a PythonPath environment variable set, nor any *.pth files. At
this point, I'm assuming that the five base entries of sys.path are set in
the source C code, and that I'll need to load the source tree and look there
to find where things start.
Until I located the registry entry, I'd patched site.py to strip out the
duplicates, but couldn't find an obvious way to transform the tilde
referenced directories. Is there a way to know full path name of
'D:\\PROGRA~1\\PYTHON\\TOOLS\\IDLE' vs 'D:\\PROGRA~2\\PYTHON\\TOOLS\\IDLE' ?
Cut-my-path-search-time-by-two-hoping-to-make-it-three'ly yrs
--
Emile van Sebille
emile at fenx.com
More information about the Python-list
mailing list