pth information

Paul Moore paul.moore at uk.origin-it.com
Thu Feb 15 09:33:13 EST 2001


On Wed, 14 Feb 2001 23:02:50 +0100, "Don Tuttle"
<tuttledon at hotmail.com> wrote:

>Question:  Where does Python look first?  The PythonPath or for a .pth file?

The standard module site.py is loaded first. You can read the source
of this for the definitive answer, but basically, site.py searches the
sirectory sys.prefix (and maybe sys.exec_prefix) for files whose names
end in ".pth". All such files are read, and each line is treated as
the name of a directory (relative to the directory containing the .pth
file, if it isn't an absolute name already) to be added at the end of
sys.path.

All this happens at startup, and from then on, sys.path is just used
as normal.

Hope this helps,
Paul.




More information about the Python-list mailing list