get directory name of file being executed
bh at intevation.de
Thu Feb 27 18:28:08 CET 2003
Skip Montanaro <skip at pobox.com> writes:
> David> I'm doing this:
> David> /usr/bin/python2 /some/script/in/a/dir/foo.py
> David> I want to get "/some/script/in/a/dir/", not the cwd of where I
> David> launched the script from.
> Inside foo.py you have a global variable __file__.
Not with Python 2.2.x, unfortunately. This will work with 2.3, though.
Intevation GmbH http://intevation.de/
More information about the Python-list