Empty sys.path[0]

Gustaf Liljegren gustafl at algonet.se
Sat Jul 7 10:31:13 EDT 2001


I have a script that I run from the command line in Windows. I need to feed 
it with configuration settings from an external file. I decided that this 
file must be in the same directory as the python script.

The problem is that I can't find a way to get this directory. The docs say 
that sys.path[0] should be used for this, but that does only return an 
empty string.

A second question: In the future, I'll use py2exe to make a DOS binary of 
this script. Will this make any difference when retrieving the script 
directory?

Regards,

Gustaf Liljegren



More information about the Python-list mailing list