How to get full path to script?

kj socyl at
Mon Jun 9 18:07:50 CEST 2008

In <mailman.228.1213022580.1044.python-list at> "Mike Driscoll" <kyosohma at> writes:

>For my compiled scripts, I usually use this variation:

>path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0])))

Thanks.  But why the os.path.join()?  (BTW, I did read the docs
before posting, but they make no sense to me; they say that
os.path.join joins "one or more path components intelligently",
but what does it mean to join *one* component?)


NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.

More information about the Python-list mailing list