Is there a way to get the path to an executable that runs the current python script (from within the python script)?
That should do what you want.
>>> import sys >>> sys.executable 'C:\\Python26\\python.exe' >>> import os >>> os.path.dirname(sys.executable) 'C:\\Python26'