How do packages and .pth files work under Windows (Py 2.0)
jonathan.gilligan at vanderbilt.edu
Tue Dec 5 21:46:19 CET 2000
Thanks, but this doesn't tell me about when python reads .pth files,
which is the crux of my problem. Between this and writing a
__init__.py file which properly initializes the variable __all__, I
managed to work around my immediate problem.
I have managed to resolve another part of my problem---it seems that
Python reads the default value of the registry key
"HKLM\Software\Python\CurrentVersion\2.0\PythonPath" only if it cannot
resolve PYTHONHOME. If it can resolve PYTHONHOME, then it ignores the
default value in "HKLM\Software\Python\CurrentVersion\2.0\PythonPath"
and substitutes some default directories instead for the PYTHONPATH.
It does add any values in keys below PythonPath, but not the value at
the top of the tree.
This is undocumented, but can be found in the C code in getpathp.c.
I'd still like to know how to use .pth files properly, though, if
anyone can help.
"Stuart" <sgm103 at cs.york.ac.uk> wrote in message
news:z26X5.15943$R77.1248181 at nnrp4.clara.net...
> > It would help me enormously if there were a way to get Python to
> > out a list of where it looks when it tries to resolve an "import".
> > this possible?
> I'm not certain, but i think this does the trick:
> import sys
> print sys.path
More information about the Python-list