How can I find the full path to the currently running Python script? That is to say, what do I have to do to achieve this:
$ pwd /tmp $ python baz.py running
import sys, os file = sys.argv[0] pathname = os.path.dirname(file) print 'running from %s' % os.path.abspath(pathname) print 'file is %s' % file
Check os.getcwd() (docs)