[Python-Dev] sys.path[0]

James C. Ahlstrom jim@interet.com
Wed, 08 Jan 2003 09:33:03 -0500


Thomas Heller wrote:

> Shouldn't Python convert sys.path to absolute path names, to avoid
> these problems?

IMHO, yes.  If the directory of the script file is important
enough to be sys.path[0], then it should be an absolute path.

I believe this was discussed before at the time of PEP 273.
Anyway, my implementation of PEP 273 adds the absolute path,
and also moves the insertion of sys.path[0] prior to the
import of site.py to emiminate yet another source of confusion.

These features can be extracted from PEP 273, and they work on
Unix and Windows.  Just apply all patches except for import.c.

JimA