How do I change a process name or even a thread name in python!

Kenneth Loafman ken at lt.com
Mon Feb 12 16:50:35 EST 2001


C manages because the executable is the same as the program.  A script
is different.  The interpreter name (python, sh, bash, etc.) will appear
as the name if you run it like '$ python foo.py'.  Same applies to '$ sh
script'.

Try putting a '#! /usr/bin/python' as the first line, then running it as
'$ ./foo.py'.  Under Linux/UNIX, that picks up the right name and
arguments for ps aux.

If you have to run it as 'python foo.py ...', I have no idea.

...Ken

Fionn Behrens wrote:
> 
> I am sick of seeing 10x"python" in top, without being able to say which is
> which.
> 
> I mean the name of the process as it appears in "ps" or "top". Obviously,
> changing argv[0] like in C does not do the trick (which would not be of
> much use for distinguishable threads anyway)
> 
> Any suggestions?
> 
> Regards,
>         Fionn
> --
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list