win32com and makepy

Mark Hammond MarkH at ActiveState.com
Sat Feb 24 09:58:33 EST 2001


Sean Laurent wrote:

> As a side note, I'm still puzzled as to why the original code didn't
> work:
>      >>>> gencache.EnsureModule(blahblah)
>      >>>> i = win32com.client.Dispatch("WindowsInstaller.Installer")
> 
> I spent some time stepping through the code and I found that the code
> was bailing in win32com.client.dynamic._GetGoodDispatch() at the line
> reading:
>      IDispatch = pythoncom.connect(IDispatch)
> 
>      com_error: (-2147221021, 'Operation unavailable', None, None)

This should be fine - we then go and try the CoCreateInstance route and end up down the same path you traced.

> The other bizarre thing I found was in __WrapDispatch() in
> win32com.client.__init__.  In this function, you find the following
> code:
>      if resultCLSID is None:
>           try:
>                typeinfo = dispatch.GetTypeInfo()
> 
> In this case, we don't have a CLSID, so this code gets called.  Yet it
> bails with:  "com_error: (-2147467262, 'No such interface supported',
> None, None)"  which seems a bit bizarre, since dispatch is of type
> PyIDispatch - which should support this method...

This is the crux of the whole problem.  The object implements GetTypeInfo, but just fails to provide it.  If this was available, then win32com would be able to find the CLSID of the object, and get the makepy generated class.

> Any thoughts?  Am I beating a dead horse?

Pretty much I fear - at least until MS upgrade their interfaces.

Mark.
-- 
Nominate Your Favorite Programmers
for the Perl and Python Active Awards!
http://www.ActiveState.com/Awards/




More information about the Python-list mailing list