Finding the Process Path
Steve Holden
steve at holdenweb.com
Mon Oct 3 10:25:45 EDT 2005
Peck, Jon wrote:
> Thanks, but this doesn't tell me what I am looking for.
>
> I am looking for the path for the current process (which will not be the Python interpreter).
>
Actually the core image will be that of the Python interpreter.
> I see, though, that this is available as sys.executable
>
The interpreter? That's correct.
What you probably want is
import os, sys
print os.path.abspath(sys.argv[0])
this will give you the path to the Python script the interpreter is running.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list