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

[Guido]
> 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.

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']
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to