get a file or program’s full path in python
April 9th, 2008 by Lawrence David
when you execute a program in python, the program’s name can be found with the following command:
import sys
print sys.argv[0]
to get the full path to the program, use the abspath command:
import os
os.path.abspath(sys.argv[0])
Thanks.
Thanx a lot. It is just what was looking for.