Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ANNOUNCE: proctitle - manipulate 'argv[]' (process listing) of the Python process

104 views
Skip to first unread message

Dave Cinege

unread,
Jul 22, 2002, 8:00:55 PM7/22/02
to
keyphrases:
setproctitle proctitle
change process name
change process title
change ps output
argv[0] argv[-1]

It was about a year ago, I produced a nasty patch to sys that allowed
changing the raw argv[] of the python process.

A year later its sad this functionality has *still* not be intergrated
into Python itself. : <

In linux this modules allows one to change the output seen from 'ps'.
(And the processes 'cmdline' in /proc/)
It is useful for hiding 'python', an argument that is a password,
or update process information.

The joy of unempoyment has given me the time to rewrite my patch as
a stand alone module. The module is by no means done. I need people
to test on platforms other then Linux and provides results.

Once it has been made portable, I intend to talk to Guido about how
he'd like to see this intergrated into Python, and then do so.
It would likely become an extension to the posix module.

Please DL from:
http://ftp.psychosis.com/python/
ftp://ftp.psychosis.com/python/


An idea how it currently works:

import proctitle
Argv = proctitle.ProcTitle()

print 'Saving Original argv[]'
Argv.save()
print 'argv[0:2]: ', Argv[0:2]
print Argv

Argv[0] = 'Python - Why use anything else?'
Argv[0:] = 'Python - Why use anything else?'

print 'Slide argv args back one. (hide "python")'
print 'Process line now matches sys.argv'
Argv[0:] = string.join(Argv[1:]).replace(',','')

print 'Restoring Original argv[]'
Argv.restore()

Tino Lange

unread,
Jul 24, 2002, 12:51:59 AM7/24/02
to
On Mon, 22 Jul 2002 20:00:55 -0400, Dave Cinege
<dci...@psychosis.com> wrote:

> I produced a [module] that allow[s]


>changing the raw argv[] of the python process.

Great! That's what I was looking for!
Thanks a lot!

Tino

David Rushby

unread,
Aug 15, 2002, 4:26:03 PM8/15/02
to
Dave Cinege <dci...@psychosis.com> wrote in message news:<mailman.102738261...@python.org>...

> keyphrases:
> setproctitle proctitle
> change process name
> change process title
> change ps output
> argv[0] argv[-1]
>
> In linux this modules allows one to change the output seen from 'ps'.
> (And the processes 'cmdline' in /proc/)
> It is useful for hiding 'python', an argument that is a password,
> or update process information.
> ...
> Once it has been made portable...

Does anyone know if Windows supports this functionality? My search
of MSDN's Windows API documentation and Google was fruitless.

Just to be explicit: I know that the proctitle module in its
current state doesn't work on Windows; I'm asking whether Windows
allows the process title to be changed, rather than whether proctitle
currently works on Windows.

0 new messages