
Hi, I'm trying to understand the initialization of sys.path and especially if CWD is supposed to be included in sys.path by default. (I understand the purpose of sys.path[0], that is not the focus of my question). My setup is Python2.0 on Win2000, no PYTHONHOME or PYTHONPATH envvars. In this setup, an empty string exists as sys.path[1], but I'm unsure if this is by careful design or some freak accident. The empty entry is added because HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.0\PythonPath does *not* have any subkey. There are a default value, but that value appears to be ignored. If I add a subkey "foo": HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.0\PythonPath\foo with a default value of "d:\foo", the CWD is no longer in sys.path. i:\java\jython.cvs\org\python\util>d:\Python20\python.exe -S Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information.
I noticed that some of the PYTHONPATH macros in PC/config.h includes the '.', others does not. So, to put it as a question (for jython): Should CWD be included in sys.path? Are there some situation (like embedding) where CWD shouldn't be in sys.path? regards, finn

On Unix, CWD is not in sys.path unless as sys.path[0]. --Guido van Rossum (home page: http://www.python.org/~guido/)

On Unix, CWD is not in sys.path unless as sys.path[0]. --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (2)
-
bckfnn@worldonline.dk
-
Guido van Rossum