On 10/11/05, Tim Peters firstname.lastname@example.org wrote:
Well, that's in interactive mode, and I see sys.path == "" 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 ;-)
How did you test batch mode?
I gave full code (it's brief) and screen-scrapes from Windows and Linux yesterday:
By batch mode, I meant invoking
from a shell prompt.
sys.path 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, typically).
In my runs, sys.argv was the path to the Python executable, not to the script being run.
I tried your experiment but added 'print sys.argv' and didn't see that. sys.argv is the path to the script.
The directory of the script being run was nevertheless in sys.path 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.
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/%7Eguido/)