[Tutor] Getting Running File's Name

Rinzwind w.damen at gmail.com
Tue Jan 31 09:17:00 CET 2006


Why would that be any different under Linux?

sys.argv[0]

Wim

On 1/31/06, Hans Dushanthakumar <Hans.Dushanthakumar at navman.com> wrote:
> Under WinXP, the variable
> sys.argv[0] holds the script file name (including the path). Not sure,
> but it may work the same under Linux as well.
>
>
> -----Original Message-----
> From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
> Behalf Of Bryan Carbonnell
> Sent: Tuesday, 31 January 2006 3:11 p.m.
> To: tutor at python.org
> Subject: [Tutor] Getting Running File's Name
>
> Can Python return the name of the current file's name?
>
> In other works, if I am running a Python file (MyPythonFile.py) is there
> a function that will return 'MyPythonFile.py'?
>
> This will be used in Linux if that matters.
>
> Thanks
>
> --
> Bryan Carbonnell - carbonnb at sympatico.ca
> Warning: dates on calendar are closer than they appear.
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list