[python-win32] Python path for COM objects?

Jeff Shannon jeff@ccvcorp.com
Thu, 24 Jan 2002 14:38:52 -0800


I'm trying out ActivePython 2.2, and have run into an
interesting problem.  (Yeah, I know I was just asking about
upgrading to 2.1--I've got some machines on 2.1 and some on
2.0, I'm thinking of moving them all to 2.2 now...)

I have a wxPython-based application that I've wrapped up as
a COM object.  It works fine under Python 2.1, but after
upgrading to 2.2, it fails trying to import wxPython
(ImportError: No module named wxPython.wx).  This import
error *only* happens when running from COM; if I run my app
from the command line, it finds everything just fine, but
can't seem to do so from within the COM server.

Now, the 2.1 version of wxPython installed into
Python21\wxPython, but the 2.2 version has gone into
site-packages (Python22\Lib\site-packages\wxPython).  This
is the only change I can think of that should affect things,
unless there's some alteration of the python path from
within pythoncom 2.2 (vs 2.1).  So... how *does* the python
path get initailized in 2.2?  Is there a registry entry I
need to tweak?  (I've tried using a .pth file in \Python22,
with no success.)