Win32 COM

Tom Plunket tomas at
Fri Nov 3 00:23:59 CET 2006

Tom Plunket wrote:

> I don't know anything about COM beyond the fact that I can look in the
> OLE/COM browser to maybe figure out the API that an object has that I
> need to operate on.

I'm still not entirely sure what's going on, because there are some
methods and properties that are available before doing this, but
makepy was part of my solution.

What I wanted to avoid was explicitly going around and running makepy
N times on everyone's machine that might need to run this toolset.
What I discovered I could do was run makepy with a -i command-line
parameter, which would emit code that would kick the gencache to
implicitly run makepy if necessary.  So, problem solved!

in my case:

: C:\Python24\Lib\site-packages\win32com\client>makepy -i
: NxNXMLHelper 1.0 Type Library
:  {5E7B0F01-92C1-11D3-A5FB-00104B45886F}, lcid=0, major=1, minor=0
:  >>> # Use these commands in Python code to auto generate .py support
:  >>> from win32com.client import gencache
:  >>> gencache.EnsureModule('{5E7B0F01-92C1-11D3-A5FB-00104B45886F}', 0, 1, 0)

Very handy!


More information about the Python-list mailing list