Finding Script Directory
michael at foord.net
Wed Jul 7 14:26:16 CEST 2004
What's the best, cross platform, way of finding out the directory a
script is run from ?
I've googled a bit, but can't get a clear answer.
On sys.argv the docs say :
argv is the script name (it is operating system dependent whether
this is a full pathname or not).
So this doesn't seem to be the answer.
The script directory is always *somewhere* in sys.path - but not
always in position 0. If you use py2exe then sys.path is the
zipfile it does the imports from !!
More information about the Python-list