argv[0] manipulation

Mark Jackson mjackson at alumni.caltech.edu
Thu Dec 12 10:46:54 EST 2002


 P_spam_ at draigBrady.com writes:
> 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"? Then how am I supposed to, say,
> > check for a config file in my script's directory? Or find the data file
> > locations based on my script's location?
> 
> Yes that is a problem. I tried tcsh on RH7.3 and ksh on FreeBSD with
> the same result (path is not prepended).

On SPARC Solaris 8 all shells tested (csh, sh, tcsh, ksh) work as they
should:

    yngvi> myscript.py
    /localhome/mjackson/bin/myscript.py

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
	It is impossible to design a system so perfect that
	no one needs to be good.  - T. S. Eliot





More information about the Python-list mailing list