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.