Is it possible to get the name of an application ?

Gary M. Josack gary at byoteki.com
Sat Oct 4 15:16:32 CEST 2008


Stef Mientki wrote:
> hello,
>
> for a general debug routine,
> written in some module.
> I want to write the information to a file,
> with name derived from the main python file.
>
> Is it possible to get the name of the python script started first ?
>
> thanks,
> Stef Mientki
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Is sys.argv[0] what you want? If so, then os.path.basename(sys.argv[0]) 
is probably what you want.

Thanks,
Gary M. Josack



More information about the Python-list mailing list