[Python-Dev] Re: Path hacking
James C. Ahlstrom
Thu, 16 Sep 1999 10:58:48 -0400
Guido van Rossum wrote:
> Hmm... PYTHONPATH gets inserted in front of the default sys.path.
> (Many moons ago that was different. But it has been like this for a
> loooooong time.) So are you worried that someone put a *different*
> exceptions.py or site.py on their path?
Yes, and/or (2) added a sitecustomize.py with their special
import hook as has been proposed here over and
over, or (3) PYTHONPATH is screwed up and doesn't find anything.
Perhaps this is a prejudice of mine. I just look at "print sys.path"
and marvel at what I don't understand. At least I can see it is
not simple. I hate relying on thing that are not simple.
And I hate custom import hooks. Unless they are mine of course ;-)
> Hm, I dug out the oldest site.py I have (used in Python 1.4), and it
> doesn't encourage editing it at all -- it tells you to use
> sitecustomize.py. I guess they could break your installation anyway,
> but only by messing with the general Python installation.
Just adding sitecustomize.py would do it. And this is encouraged.
I think Gordon put his finger on the issue. Either try to co-exist
with other installed Python software and take the risk that everyone
is playing by the rules, or build your own black-box
self-contained Python world and duplicate storage.
> The usual :-)
> [Documentation goes here...]
Thanks. This is very useful.
But it doesn't help, perhaps as a result of more of my prejudices.
This registry entry is meant to be used by a by-the-rules shared
Python installation, so I must not change it. And I hate changing
any registry entries at all. My commercial software keeps all its
settings in a regular .ini file in its install directory, and makes
only minimal and required registry entries. IMHO the Windows registry
is a software catastrophe which ranks right up there with JCL (anyone
else here old enough to remember that?). Anyone who doesn't agree
go with me to our money center banking clients, and sit there while they
grill you on every registry entry and why it is required. Money center
banking clients do not like their registry messed with.
I do however see your point that I could change the version string
to something non-standard and use the registry to control imports.
I will think about this further. Maybe it would work.
My current "solution" is to use freeze to create a black-box install,
and worry about second Python installations and wasted storage when it
I was hoping that this thread whould result in a consensis of what
to do, but it has not.
So now I am hoping that Python library (jar) files will turn out to
be a practical solution, so I am pestering Greg and Gordon. We'll see.