[Python-Dev] Re: Change to sys.path[0] for Python 2.3

James C. Ahlstrom jim@interet.com
Mon, 26 Nov 2001 10:10:22 -0500


"Martin v. Loewis" wrote:
> 
> > This insertion occurs after a number of imports have already
> > occurred.  Specifically, it occurs after the import of site, os, and
> > sitecustomize.  This is confusing.  It is clear that sys.path should
> > not change unless the user changes it.
> 
> I disagree. It is clear that sys.path will change during "bootstrap",
> e.g. as the result of processing .pth files.

I wasn't clear.  I didn't mean that sys.path shouldn't change, I
meant that Python's starting sys.path[0] shouldn't be different
from Python's starting sys.path[1:].  These are set up by Python.
The programmer is free to alter sys.path later.
 
> > If we want the directory of the script to be sys.path[0], then an
> > absolute path should be inserted.
> 
> I think this would be unimplementable in the general case.

At least it is easy to replace "" with getcwd(), and this is
valuable.

JimA