sys.prefix in COM

Sue Giller sag at hydrosphere.com
Tue Nov 27 17:18:28 EST 2001


Gordon McMillan wrote:
 
> There is a reason for this. sys.prefix is really only meaningful on
> *nix. On  Windows it is usually taken (correctly) to mean "where the
> executable is". site.py & friends can be picked up from there.
> 
> If you registered your COM objects as CLSCTX_LOCAL_SERVER you would
> indeed have a sys.prefix. But if it's inprocess, the executable isn't
> Python. In fact, pythoncomXX.dll loaded pythonXX.dll for you, and
> without knowing where their python.exe lives, they're lost. Well, only
> a little.

I guess I can accept this, but how does the python path get built that 
has all the other python things in it:  there are the various 
python21\lib, ... things, but not any that should be found from the 
.pth files.  I even tried calling site.py in my test com object but that 
got the same results - a blank .prefix string.

> I've never encountered this problem, but I'd guess you could tweak
> Python's registry entries to get around this.

I hate the registry - hassles abound.  I would rather do anything else 
including hard coding the path and forcing other users to use my 
paths :)





More information about the Python-list mailing list