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

Kenneth Loafman ken at lt.com
Tue Feb 13 08:48:58 EST 2001


Donn Cave wrote:
> 
> Quoth Kenneth Loafman <ken at lt.com>:
> | 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.
> 
> It does?  I don't think so!
> 
> $ ./iam &
> [1] 28372
> $ ps wwaux | fgrep iam
> donn     28372  0.8  0.4  2768 1140 pts/1    S    16:31   0:00 /usr/local/bin/python ./iam

You're right.  My top shows it as foo.py, but ps does not.  I may have
been confusing the behavior with Solaris.  Its been a while since I
touched a Sun box though.

...Ken




More information about the Python-list mailing list