Re: Changing sys.argv[-1]

Adrian Phillips (tandem@freeze.oslo.dnmi.no)
Wed, 16 Mar 1994 14:30:03 +0000

On Mar 16, 2:13pm, Guido.van.Rossum@cwi.nl wrote:
> Subject: Re: Changing sys.argv[-1]
> > Hope you're not to sick of me yet.
>
> Hmm... Maybe you could shorten your signature to two lines :-)

Yes, getting sick of seeing it myself

>
> > Right, what I would like to do is change the python process's argv
> > so that a ps shows the <script name> not python <scriptname>. Now
> > sys.argv[0] contains the script name, and it is possible to do this,
> > perl does using $0, but I think it is OS dependent.
>
> For executable python scripts with #! /usr/local/bin/python as their
> first line, this happens automatically on my system (SGI IRIX 4).
>
> If you run the Python interpreter with the script as first argument,
> the script name appears in sys.argv[0] but "python" appears in the ps
> listing. The same is true for Perl though (except there "perl" appers
> in the ps listing :-).

But on AIX if you do $0 = "ksdjksdj" in perl you get that on the ps line, but
setting sys.argv[0] in python doesn't do the same.

Adrian

-- 
-------------------------------------------------------------------------
= Adrian Phillips at            | BUT any thoughts in this are purely    =
= The Norwegian Meteorological  | my own and have nothing to do with     =
= Institute   	    	        | this establishment, thankfully.        =
= Net: daap@typhoon.oslo.dnmi.no  Phone: 47 22 96 32 09 Fax: 47 22 96 30 50