Python(Path) Question, Number Two :)

Guido van Rossum guido at python.org
Thu May 18 10:40:43 EDT 2000


Stephen Hansen wrote:
> 
> Okay, now this is more of a curious question then anything else. After
> building (w/ VC++6.0 in Win98) the Python DLL/.exe file, which ends up
> in PCBuild, I ran the python.exe to test a couple things out.. I was
> wondering if it made the path/etc entries into the registry
> (E.g. 'default' values).. It doesn't, I see :)
> 
> Anyways. I was expecting a failure when I attempted to import modules,
> since my peeking at the source indicated (in, e.g., config.h) that the
> default pythonpath was being set to .\lib, .\others.. but Python
> (smartly?) found the lib in ..\lib.
> 
> Now the actual question -- why? :) Where does Python search for its
> library, and what does it ask where to find it? My understanding
> (flawed?) is that the environment variable PYTHONPATH overrides the
> registry, which overrides those hardcoded values...
> 
> What's the exact registry key that it looks for the Pythonpath info?
> \Software\Python\PythonCore\(MS_DLL_ID String from python_nt.c)
> \Pythonpath?

No time to explain it all, but you can read the details in PC/getpthp.c.
Note that in Python 1.6 this has changed a lot (for the better).

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-list mailing list