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',
When PC/getpathp.c says:
- Python always adds an empty entry at the start, which corresponds to the current directory.
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.
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.
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.