The folder a script is executed in

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at
Tue Aug 21 11:47:50 CEST 2007

Ant wrote:

> Do you mean the folder containing the script? Or the current
> working directory?
> If the former, then look at os.path.split(sys.argv[0])[0]
| #!/usr/bin/env python
| import sys,os
| print os.path.split(sys.argv[0])[0]

$ cd tmp
~/tmp$ ../ 

That's rather not what's intended. I'd try os.path.abspath(__file__)



BOFH excuse #113:

Root nameservers are out of sync

More information about the Python-list mailing list