[Python-Dev] PythonCore\CurrentVersion

Tim Peters tim.peters at gmail.com
Tue Oct 11 00:42:26 CEST 2005


[Martin v. Löwis]
>> 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)?

[Mark Hammond]
> 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.

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?).


More information about the Python-Dev mailing list