Changing python process name (or argv[0])

Daniel Fackrell newsgroups.NOSPAM at dfackrell.mailshell.com
Thu Jun 5 16:14:58 CEST 2003


mike wakerly wrote:
> Hi Michael and Skip,
>
> Thanks for the responses!
>
> On Wednesday 04 June 2003 08:04 am, Michael Chermside wrote:
>> Mike writes:
>>> I think the functionality is desirable for some
>>> (at least on Unix python), and this simple trick hardly warrants an
>>> extra module if it is indeed acceptable in the python world.
>>
>> Mike, you have it exactly backwards. This simple trick hardly
>> warrents inclusion in core Python when it can be implemented
>> by an extra module. The fact that it _is_ a simple trick is
>> a good reason to keep it as a module. The fact that it might
>> not be portable to all operating systems is another good
>> reason. Don't be afraid to use modules... that's what they're
>> for!
>
> Aiyee, I was worried about this; it is what my 'acceptable in the
> python world' qualifier was for. It may be a simple trick, or it may
> be expected functionality (if uncommon). Yes, I am all for using
> modules where appropriate; not everybody's hack needs to be part of
> python (see Perl..), etc.. I've only just discovered this trick and
> couldn't find much discussion on whether or not it is considered a
> kludge.
>
> (An 'Argv_write' module just seemed a bit inelegant to my eyes;
> perhaps I underestimate the rarity of its usefulness, but [as in my
> original problem], I see few other ways to 'hide python' from
> unintelligent interfaces.)
>
> So, it would seem that rewriting argv[0] is indeed not a necessary
> standard feature, since, according to Skip:
>
>> In addition, the idea was rejected by Guido in the past (I remember
>> because I proposed it).  I doubt he's changed his mind on the topic
>> in the past few years.
>
> I'll have to do some homework and find that thread; maybe it will
> reveal why argv rewriting is good/bad/standard/uncommon.
>
> Thanks all,
> Mike

Hrm... maybe I'm just naive on this point, but it seems to me that having
python programs show up by name is ps, top, etc. would be a nice benefit,
especially where many different python processes might be running
simultaneously.  I'd even consider that such should be the default.  I for
one would much rather see ChatServer.py, intermud.py, and python listed by
ps (for a chat server, intermud daemon, and interactive python shell,
respectively), than python, python, and python.  Should this really require
finding, downloading, and installing a non-standard module?

--
Daniel Fackrell (newsgroups.NOSPAM at dfackrell.mailshell.com)
When we attempt the impossible, we can experience true growth.






More information about the Python-list mailing list