Simple way to get the full path of a running script?
Benjamin Han
bhan at andrew.cmu.edu
Sat Dec 27 21:19:57 EST 2003
On Sat, 27 Dec 2003, Mark McEahern wrote:
> On Sat, 2003-12-27 at 18:02, Benjamin Han wrote:
> > Duh - the way I described seems to be simple enough:
> >
> > pathToScript=os.join(os.getcwd(),os.path.split(sys.argv[0])[0])
>
> me = sys.argv[0]
> print "This is the absolute path: %s" % (os.path.abspath(me),)
Thank you - this is even better!
More information about the Python-list
mailing list