PythonCore\CurrentVersion

What happened to the CurrentVersion registry entry documented at http://www.python.org/windows/python/registry.html AFAICT, even the python15.wse file did not fill a value in this entry (perhaps I'm misinterpreting the wse file, though). So was this ever used? Why is it documented, and who documented it (unfortunately, registry.html is not in cvs/subversion, either)? Regards, Martin

I believe I documented it many moons ago. I don't think CurrentVersion was ever implemented (or possibly was for a very short time before being removed). The "registered modules" concept was misguided and AFAIK is not used by anyone - IMO it should be deprecated (if not just removed!). Further, I believe the documentation in the file for PYTHONPATH is, as said in those docs, out of date, but that the comments in getpathp.c are correct. Cheers, Mark

[Martin v. Löwis]
[Mark Hammond]
It would be good to update that web page ;-) The construction of PYTHONPATH differs across platforms, which isn't good. Here's a key difference: playground/ someother/ script.py This is script.py: """ import sys from pprint import pprint pprint(sys.path) """ Suppose we run script.py while playground/ is the current directory. I'm using 2.4.2 here, but doubt it matters much. No Python-related envars are set. Windows (and the PIL and pywin32 extensions are installed here): C:\playground>\python24\python.exe someother\script.py ['C:\\playground\\someother', 'C:\\python24\\python24.zip', 'C:\\playground', 'C:\\python24\\DLLs', 'C:\\python24\\lib', 'C:\\python24\\lib\\plat-win', 'C:\\python24\\lib\\lib-tk', 'C:\\python24', 'C:\\python24\\lib\\site-packages', 'C:\\python24\\lib\\site-packages\\PIL', 'C:\\python24\\lib\\site-packages\\win32', 'C:\\python24\\lib\\site-packages\\win32\\lib', 'C:\\python24\\lib\\site-packages\\Pythonwin'] When PC/getpathp.c says: * Python always adds an empty entry at the start, which corresponds to the current directory. I'm not sure what it means. The directory containing the script we're _running_ shows up first in sys.path there, while the _current_ directory shows up third. Linux: the current directory doesn't show up at all: [playground]$ ~/Python-2.4.2/python someother/script.py ['/home/tim/playground/someother', '/usr/local/lib/python24.zip', '/home/tim/Python-2.4.2/Lib', '/home/tim/Python-2.4.2/Lib/plat-linux2', '/home/tim/Python-2.4.2/Lib/lib-tk', '/home/tim/Python-2.4.2/Modules', '/home/tim/Python-2.4.2/build/lib.linux-i686-2.4'] I have no concrete suggestion, as any change to sys.path will break something for someone. It's nevertheless not good that "current directory on sys.path?" doesn't have the same answer across platforms (unsure why, but I've been burned by that several times this year, but never before this year -- maybe sys.path _used_ to contain the current directory on Linux?).

I believe it used to mean that literally '' was at the start of sys.path, but all the way back to 1.5.2 it seems that it really is the dirname of the script. Up to 2.2 it was as specifed in sys.argv, in 2.3 and later it was made absolute.
That's strange - I don't see the current directory at all in any version. I get something very close to you when I have PYTHONPATH=. - although it then turns up as the second entry, consistent with the docs. Mark

On Monday 10 October 2005 18:42, Tim Peters wrote:
never before this year -- maybe sys.path _used_ to contain the current directory on Linux?).
It's been a long time since this was the case on Unix of any variety; I *think* this changed to the current state back before 2.0. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org>

Fred L. Drake, Jr. wrote:
Please check again: [GCC 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
We still have the empty string in sys.path, and it still denotes the current directory. Regards, Martin

[Tim Peters]
never before this year -- maybe sys.path _used_ to contain the current directory on Linux?).
[Fred L. Drake, Jr.]
It's been a long time since this was the case on Unix of any variety; I *think* this changed to the current state back before 2.0.
[Martin v. Löwis]
Well, that's in interactive mode, and I see sys.path[0] == "" on both Windows and Linux then. I don't see "" in sys.path on either box in batch mode, although I do see the absolutized path to the current directory in sys.path in batch mode on Windows but not on Linux -- but Mark Hammond says he doesn't see (any form of) the current directory in sys.path in batch mode on Windows. It's a bit confusing ;-)

On 10/11/05, Tim Peters <tim.peters@gmail.com> wrote:
How did you test batch mode? All: sys.path[0] is *not* defined to be the current directory. It is defined to be the directory of the script that was used to invoke python (sys.argv[0], typically). If there is no script, or it is being read from stdin, the default is ''. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

[Tim]
[Guido]
How did you test batch mode?
I gave full code (it's brief) and screen-scrapes from Windows and Linux yesterday: http://mail.python.org/pipermail/python-dev/2005-October/057162.html By batch mode, I meant invoking path_to_python path_to_python_script.py from a shell prompt.
In my runs, sys.argv[0] was the path to the Python executable, not to the script being run. The directory of the script being run was nevertheless in sys.path[0] on both Windows and Linux. On Windows, but not on Linux, the _current_ directory (the directory I happened to be in at the time I invoked Python) was also on sys.path; Mark Hammond said it was not when he tried, but he didn't show exactly what he did so I'm not sure what he saw.
If there is no script, or it is being read from stdin, the default is ''.
I believe everyone sees that.

On 10/11/05, Tim Peters <tim.peters@gmail.com> wrote:
I tried your experiment but added 'print sys.argv[0]' and didn't see that. sys.argv[0] is the path to the script.
I see what you see. The first entry is the script's directory, the 2nd is a nonexistent zip file, the 3rd is the current directory, then the rest is standard library stuff. I suppose PC/getpathp.c puts it there, per your post quoted above? -- --Guido van Rossum (home page: http://www.python.org/~guido/)

[Guido]
I tried your experiment but added 'print sys.argv[0]' and didn't see that. sys.argv[0] is the path to the script.
My mistake! You're right, sys.argv[0] is the path to the script for me too. [Tim]
[Guido]
So why doesn't Mark see that? I'll ask him ;-)
I suppose PC/getpathp.c puts it there, per your post quoted above?
I don't think it does (although I understand why it's sane to believe that it must). Curiously, I do _not_ see the current directory on sys.path on Windows if I run from current CVS HEAD. I do see it running Pythons 2.2.3, 2.3.5 and 2.4.2. PC/getpathp.c doesn't appear to have changed in a relevant way. blor.py: """ import sys from pprint import pprint print sys.version_info pprint(sys.path) """ C:\>\code\python\PCbuild\python.exe code\blor.py # C:\ not in sys.path (2, 5, 0, 'alpha', 0) ['C:\\code', 'C:\\code\\python\\PCbuild\\python25.zip', 'C:\\code\\python\\DLLs', 'C:\\code\\python\\lib', 'C:\\code\\python\\lib\\plat-win', 'C:\\code\\python\\lib\\lib-tk', 'C:\\code\\python\\PCbuild', 'C:\\code\\python', 'C:\\code\\python\\lib\\site-packages'] C:\>\python24\python.exe code\blor.py # C:\ in sys.path (2, 4, 2, 'final', 0) ['C:\\code', 'C:\\python24\\python24.zip', 'C:\\', 'C:\\python24\\DLLs', 'C:\\python24\\lib', 'C:\\python24\\lib\\plat-win', 'C:\\python24\\lib\\lib-tk', 'C:\\python24', 'C:\\python24\\lib\\site-packages', 'C:\\python24\\lib\\site-packages\\PIL', 'C:\\python24\\lib\\site-packages\\win32', 'C:\\python24\\lib\\site-packages\\win32\\lib', 'C:\\python24\\lib\\site-packages\\Pythonwin']

Tim Peters wrote:
I have since done that: http://www.python.org/windows/registry.html Regards, Martin

I believe I documented it many moons ago. I don't think CurrentVersion was ever implemented (or possibly was for a very short time before being removed). The "registered modules" concept was misguided and AFAIK is not used by anyone - IMO it should be deprecated (if not just removed!). Further, I believe the documentation in the file for PYTHONPATH is, as said in those docs, out of date, but that the comments in getpathp.c are correct. Cheers, Mark

[Martin v. Löwis]
[Mark Hammond]
It would be good to update that web page ;-) The construction of PYTHONPATH differs across platforms, which isn't good. Here's a key difference: playground/ someother/ script.py This is script.py: """ import sys from pprint import pprint pprint(sys.path) """ Suppose we run script.py while playground/ is the current directory. I'm using 2.4.2 here, but doubt it matters much. No Python-related envars are set. Windows (and the PIL and pywin32 extensions are installed here): C:\playground>\python24\python.exe someother\script.py ['C:\\playground\\someother', 'C:\\python24\\python24.zip', 'C:\\playground', 'C:\\python24\\DLLs', 'C:\\python24\\lib', 'C:\\python24\\lib\\plat-win', 'C:\\python24\\lib\\lib-tk', 'C:\\python24', 'C:\\python24\\lib\\site-packages', 'C:\\python24\\lib\\site-packages\\PIL', 'C:\\python24\\lib\\site-packages\\win32', 'C:\\python24\\lib\\site-packages\\win32\\lib', 'C:\\python24\\lib\\site-packages\\Pythonwin'] When PC/getpathp.c says: * Python always adds an empty entry at the start, which corresponds to the current directory. I'm not sure what it means. The directory containing the script we're _running_ shows up first in sys.path there, while the _current_ directory shows up third. Linux: the current directory doesn't show up at all: [playground]$ ~/Python-2.4.2/python someother/script.py ['/home/tim/playground/someother', '/usr/local/lib/python24.zip', '/home/tim/Python-2.4.2/Lib', '/home/tim/Python-2.4.2/Lib/plat-linux2', '/home/tim/Python-2.4.2/Lib/lib-tk', '/home/tim/Python-2.4.2/Modules', '/home/tim/Python-2.4.2/build/lib.linux-i686-2.4'] I have no concrete suggestion, as any change to sys.path will break something for someone. It's nevertheless not good that "current directory on sys.path?" doesn't have the same answer across platforms (unsure why, but I've been burned by that several times this year, but never before this year -- maybe sys.path _used_ to contain the current directory on Linux?).

I believe it used to mean that literally '' was at the start of sys.path, but all the way back to 1.5.2 it seems that it really is the dirname of the script. Up to 2.2 it was as specifed in sys.argv, in 2.3 and later it was made absolute.
That's strange - I don't see the current directory at all in any version. I get something very close to you when I have PYTHONPATH=. - although it then turns up as the second entry, consistent with the docs. Mark

On Monday 10 October 2005 18:42, Tim Peters wrote:
never before this year -- maybe sys.path _used_ to contain the current directory on Linux?).
It's been a long time since this was the case on Unix of any variety; I *think* this changed to the current state back before 2.0. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org>

Fred L. Drake, Jr. wrote:
Please check again: [GCC 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
We still have the empty string in sys.path, and it still denotes the current directory. Regards, Martin

[Tim Peters]
never before this year -- maybe sys.path _used_ to contain the current directory on Linux?).
[Fred L. Drake, Jr.]
It's been a long time since this was the case on Unix of any variety; I *think* this changed to the current state back before 2.0.
[Martin v. Löwis]
Well, that's in interactive mode, and I see sys.path[0] == "" on both Windows and Linux then. I don't see "" in sys.path on either box in batch mode, although I do see the absolutized path to the current directory in sys.path in batch mode on Windows but not on Linux -- but Mark Hammond says he doesn't see (any form of) the current directory in sys.path in batch mode on Windows. It's a bit confusing ;-)

On 10/11/05, Tim Peters <tim.peters@gmail.com> wrote:
How did you test batch mode? All: sys.path[0] is *not* defined to be the current directory. It is defined to be the directory of the script that was used to invoke python (sys.argv[0], typically). If there is no script, or it is being read from stdin, the default is ''. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

[Tim]
[Guido]
How did you test batch mode?
I gave full code (it's brief) and screen-scrapes from Windows and Linux yesterday: http://mail.python.org/pipermail/python-dev/2005-October/057162.html By batch mode, I meant invoking path_to_python path_to_python_script.py from a shell prompt.
In my runs, sys.argv[0] was the path to the Python executable, not to the script being run. The directory of the script being run was nevertheless in sys.path[0] on both Windows and Linux. On Windows, but not on Linux, the _current_ directory (the directory I happened to be in at the time I invoked Python) was also on sys.path; Mark Hammond said it was not when he tried, but he didn't show exactly what he did so I'm not sure what he saw.
If there is no script, or it is being read from stdin, the default is ''.
I believe everyone sees that.

On 10/11/05, Tim Peters <tim.peters@gmail.com> wrote:
I tried your experiment but added 'print sys.argv[0]' and didn't see that. sys.argv[0] is the path to the script.
I see what you see. The first entry is the script's directory, the 2nd is a nonexistent zip file, the 3rd is the current directory, then the rest is standard library stuff. I suppose PC/getpathp.c puts it there, per your post quoted above? -- --Guido van Rossum (home page: http://www.python.org/~guido/)

[Guido]
I tried your experiment but added 'print sys.argv[0]' and didn't see that. sys.argv[0] is the path to the script.
My mistake! You're right, sys.argv[0] is the path to the script for me too. [Tim]
[Guido]
So why doesn't Mark see that? I'll ask him ;-)
I suppose PC/getpathp.c puts it there, per your post quoted above?
I don't think it does (although I understand why it's sane to believe that it must). Curiously, I do _not_ see the current directory on sys.path on Windows if I run from current CVS HEAD. I do see it running Pythons 2.2.3, 2.3.5 and 2.4.2. PC/getpathp.c doesn't appear to have changed in a relevant way. blor.py: """ import sys from pprint import pprint print sys.version_info pprint(sys.path) """ C:\>\code\python\PCbuild\python.exe code\blor.py # C:\ not in sys.path (2, 5, 0, 'alpha', 0) ['C:\\code', 'C:\\code\\python\\PCbuild\\python25.zip', 'C:\\code\\python\\DLLs', 'C:\\code\\python\\lib', 'C:\\code\\python\\lib\\plat-win', 'C:\\code\\python\\lib\\lib-tk', 'C:\\code\\python\\PCbuild', 'C:\\code\\python', 'C:\\code\\python\\lib\\site-packages'] C:\>\python24\python.exe code\blor.py # C:\ in sys.path (2, 4, 2, 'final', 0) ['C:\\code', 'C:\\python24\\python24.zip', 'C:\\', 'C:\\python24\\DLLs', 'C:\\python24\\lib', 'C:\\python24\\lib\\plat-win', 'C:\\python24\\lib\\lib-tk', 'C:\\python24', 'C:\\python24\\lib\\site-packages', 'C:\\python24\\lib\\site-packages\\PIL', 'C:\\python24\\lib\\site-packages\\win32', 'C:\\python24\\lib\\site-packages\\win32\\lib', 'C:\\python24\\lib\\site-packages\\Pythonwin']

Tim Peters wrote:
I have since done that: http://www.python.org/windows/registry.html Regards, Martin
participants (5)
-
"Martin v. Löwis"
-
Fred L. Drake, Jr.
-
Guido van Rossum
-
Mark Hammond
-
Tim Peters