About getting the name of the running script
Lexy Zhitenev
zhitenev at cs.vsu.ru
Tue Mar 4 12:53:56 EST 2003
Hi everyone.
So, I wanted to determine the path name of the running python script.
Why __file__ attribute isn't defined for top-level module (the one I start)?
I have seen a method to do it, and I haven't found any exceptions from it:
import sys, os.path
print os.path.abspath(sys.argv[0])
But I wonder, why __file__ is so particular?
Regards, Lexy.
More information about the Python-list
mailing list