how to get teh path of a script

Alex new_name at mit.edu
Wed Jun 13 16:17:34 EDT 2001


> I would like to get for exemple in my_script.py located at
> /home/toto/my_script.py to get in my_script.py the value "/home/toto"

Does

import sys, os
print os.path.join(os.getcwd(), sys.argv[0])

do what you want?

Alex.



More information about the Python-list mailing list