Evidence of pythoncom bug?

Bill Bell bill-bell at bill-bell.hamilton.on.ca
Fri Sep 7 08:17:43 EDT 2001


Mark Hammond <MarkH at ActiveState.com> wrote, in part:
> > Now when I attempt to do the same thing in PythonWin,
> > 
> > ---- code starts ----
> > MSHTMLInterface = CoCreateInstance ( '{25336920-03F9-11CF-
> > 8FD0-00AA00686F13}', None, pythoncom . 
> > CLSCTX_INPROC_SERVER,  '{332C4425-26CB-11D0-B483-
> > 00C04FD90119}' )
> > ---- code ends ----
> > 
> > the result is,
> > 
> > ---- output starts ----
> > Traceback (most recent call last):
> >   File "<interactive input>", line 1, in ?
> > TypeError: There is no interface object registered that supports
> > this IID ---- output ends ----
> > 
> > What do you think?
> 
> The IID translation is working fine.  The problem is that you are
> asking for an IID that PythonCOM does not support.
> 
> Try passing IDispatch - either the pythoncom.IID_IDispatch attribute,
> or the string representation of that IID.

MSHTMLIDispatch = CoCreateInstance ( '{25336920-03F9-11CF-
8FD0-00AA00686F13}', None, pythoncom .  
CLSCTX_INPROC_SERVER, pythoncom.IID_IDispatch )

appears to work. However, a query for the interrface I want (so that 
I can walk the document) croaks:

MSHTMLIDispatch.QueryInterface ( '{332C4425-26CB-11D0-B483-
00C04FD90119}' )

In fact I can obtain a few other interfaces:

MSHTMLIDispatch, MSHTMLIOleObject, MSHTMLIOleControl = 
CoCreateInstanceEx ( 'htmlfile', None, pythoncom . 
CLSCTX_INPROC_SERVER,  None, ( pythoncom . IID_IDispatch, 
axcontrol . IID_IOleObject, axcontrol . IID_IOleControl, ) )

However:

>>> MSHTMLIDispatch.QueryInterface ( '{332C4425-26CB-11D0-
B483-00C04FD90119}' )
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: There is no interface object registered that supports this 
IID

and the other two interfaces will not oblige either (I've just tried 
them again.). Yet that IID is registered as an interface with 
'(default)' of 'IHTMLDocument2':

HKCR\Interface\{332C4425-26CB-11D0-B483-00C04FD90119}

HKLM\SOFTWARE\Classes\Interface\{332C4425-26CB-11D0-B483-
00C04FD90119}

Thanks for looking at this one! I have come back to it several times 
already.

Bill

Bill Bell, Software Developer




More information about the Python-list mailing list