argv[0] manipulation

P_spam_ at draigBrady.com P_spam_ at draigBrady.com
Fri Dec 13 14:23:17 EST 2002


Bernhard Herzog wrote:
> grante at visi.com (Grant Edwards) writes:
> 
> 
>>In article <slrnavhbcp.8dm.rmunn at rmunnlfs.dyndns.org>, Robin Munn wrote:
>>
>>
>>>*Boggle*. Do you mean that tcsh and ksh, if "myscript.py" is
>>>found in $PATH, simply pass "myscript.py" as argv[0] instead of
>>>passing "/home/myusername/bin/myscript.py"?
>>
>>Yes.
> 
> 
> Really? 
> 
> Which argv are we talking about, anyway? The one in the CPython
> interpreter's main() function or sys.argv[0]?
> 
> The former is the name of the python interpreter which may well be just
> "python" but the latter is simply what's in argv[1] at the C-level and
> that must be the filename of the script in such a way that passing it
> open opens the correct file. Otherwise the Python interpreter couldn't
> run the script.

Yes you are correct I think (see my post above).

Pádraig.




More information about the Python-list mailing list