[Tutor] trouble using 2to3.py

Dave Angel davea at ieee.org
Thu Nov 5 15:58:07 CET 2009


Alan Gauld wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">
> "Dave Angel" <davea at ieee.org> wrote
>> But tell me, how does python.exe find its "home" directory, to set 
>> initial sys.path and suchlike?  
>
> Doesn't it look in the Registry?
> I haven't checked but there are a bunch of registry entries for Python 
> so I assume it checks those on startup.
>
> Alan G
>
>
>
Well, if it does, I must say I'm disappointed.  Perhaps there's still a 
simple explanation.  I expected the usual registry cruft left behind by 
the install process itself, and of course Windows requires various 
entries for things like uninstall.  And Windows adds things like LRU's 
in Explorer and elsewhere.  But looking through the registry I see 
hundreds of entries recording the various install directories for 
present and past python installs.

But I had hoped, given its portable roots, that Python's own registry 
use would be limited to things like assoc and ftype, which are used to 
find the associated python.exe, and that other dependencies would be 
resolved by python.exe itself, using its knowledge of its own location.


I have multiple installs of Python, and even  multiple installs of 2.6, 
so I suspect I'll be in trouble sooner or later, when it looks in the 
wrong directory tree for the version I thought I was running.  I 
expected the pythonNN.dll to be a conflict, but that's no problem; I use 
the latest one.  But what if I have ActivePython and Python.org installs 
of the exact same version?   I want to be able to switch back and forth 
for testing purposes, to know for sure whether I'm using features only 
available on the ActivePython version.

I tried once before, and again today, to search out information on just 
how this is managed.  But it seems all the docs I can find just describe 
how to use it, not how it's intended to work.

http://effbot.org/zone/python-register.htm
     uses sys.prefix    apparently to get the installation path of the 
currently running python

So, when I use that, it seems to track reliably the particular EXE being 
run, as I'd originally assumed.  But I haven't tried hardlinks, and I 
can't see how they'd preserve this behavior.

I hate not knowing. Too much "magic" going on.

DaveA


More information about the Tutor mailing list