How to get path of a .py script

Manuel M. Garcia mgarcia at cole-switches.com
Wed Dec 11 16:49:04 EST 2002


On Wed, 11 Dec 2002 13:42:22 -0600, Skip Montanaro <skip at pobox.com>
wrote:
(edit)
>    Manuel> if __name__ == '__main__':
(edit)
>This test won't be necessary in 2.3.

Oh, that test is not because of a deficiency in sys.argv[0] in finding
the path of the script.  You would only use this test if you wanted
the same result whether you run the script directly or 'import' it
from another script.

I probably should have been more clear

Manuel




More information about the Python-list mailing list