A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-November/018710.html below:

Change to sys.path[0] for Python 2.3

[Python-Dev] Re: Change to sys.path[0] for Python 2.3 [Python-Dev] Re: Change to sys.path[0] for Python 2.3James 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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4