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
I would suggest
import os, sys print os.path.split(os.path.abspath(os.path.realpath(sys.argv[0])))[0]
This way you can safely create symbolic links to the script executable and it will still find the correct directory.