sys.argv[0] doesn't always contain the full path of running script.

Ivan Zuzak izuzak at gmail.com
Wed Aug 30 15:59:34 EDT 2006


gmax2006 wrote:
> Hi,
>
> I use RedHat linux.
>
> How can I find where exactly the current python script is running?

Hi,

Doesnt __file__ attribute of each module contain the full filepath of
the module?
So, try this:

filepath = __file__
print filepath

Works for me :)

Cheers,
i. zuzak




More information about the Python-list mailing list