Is it possible to get the name of an application ?

Stef Mientki stef.mientki at gmail.com
Sat Oct 4 09:28:43 EDT 2008


Gary M. Josack wrote:
> 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?
thanks Gary,
That's exactly what I was looking for.
cheers,
Stef
> 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