How to obtain python file path

Dave Benjamin ramen at lackingtalent.com
Tue Apr 1 16:39:16 EST 2003


In article <20030401163212631-0500 at news.covad.net>, Dan Grassi wrote:
> I need to obtain the full path of the python.py file that the program is 
> executing from wether imported or run as main.

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

HTH,
Dave




More information about the Python-list mailing list