Name of the Script

Alex Martelli aleaxit at yahoo.com
Mon Mar 5 10:09:37 EST 2001


"Paul Moore" <paul.moore at uk.origin-it.com> wrote in message
news:FpmjOjvwe5bm0Bg09LDTMPhh5vji at 4ax.com...
    [snip]
> --- a.py ---
> import sys
> print sys.argv[0]
> ---
>
> python a.py
>
> just prints "a.py". Is there a way of getting the *full* script name.

import sys, os.path

print os.path.abspath(sys.argv[0])


Alex






More information about the Python-list mailing list