I' having a problem with gencache.Ensure Module:
I used win32com\client \makepy.py to successfully generate Python
sources.
Unfortunately, after I call win32com.client .Dispatch(), the object I
get back is of type "COMObject" instead of one of the generated
classes.
In particular, I'm trying to interact with SolidWorks Extensibility
Type Library and the PROGID is "SldWorks.Appli cation".
Using win32com\client \makepy.py -i
SolidWorks Extensibility Type Library
{801A0000-A66C-11D3-A8BD-0000861EBBD6}, lcid=0, major=1, minor=0
0, 1, 0)>># Use these commands in Python code to auto generate .py support
from win32com.client import gencache
gencache.Ensu reModule('{801A 0000-A66C-11D3-A8BD-0000861EBBD6}',
Looking in win32com\gen-py, the appropriate file _does_ exist:
801A0000-A66C-11D3-A8BD-0000861EBBD6x0x 1x0.py
and it does contain the correct class definitions.
Then, in my code:
None>>mod = win32com.client .gencache.Ensur eModule('{801A2 001-A66C-11D3-A8BD-0000861EBBD6}', 0, 1, 0)
mod
<COMObject SldWorks.Applic ation>>>ob = win32com.client .Dispatch("SldW orks.Applicatio n")
ob
Why are the object mod is None and the object ob is <COMObject
SldWorks.Applic ation instead <win32com.gen_p y.<blah>>?
Any bright ideas as to what's going wrong here?
Thanks for your hints, Kai