Tor Hildrum wrote:
> The full pathname is in sys.argv[0]
At least on my system, it only includes the filename if executed from
the current directory.

Example:

[EMAIL PROTECTED]:/$ cd ~
[EMAIL PROTECTED]:~$ cat > test.py
from sys import argv
print argv[0]
[EMAIL PROTECTED]:~$ python test.py
test.py
[EMAIL PROTECTED]:~$ cd /
[EMAIL PROTECTED]:/$ python test.py
/home/jordan/test.py
[EMAIL PROTECTED]:/$

So, if you _ALWAYS_ need an absolute path, just using sys.argv[0] might
not work.

Jordan Greenberg


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to