win32com.client - need some help

Alex Martelli aleaxit at yahoo.com
Thu Jan 25 12:25:21 EST 2001


<zippy1984 at my-deja.com> wrote in message news:94pa5c$aqb$1 at nnrp1.deja.com...
>
> >
> > Pretty unusual VB usage, but, yes, it does happen.  It's unclear
    [snip]
> Here is a snip of the IDL file:
>
>    HRESULT getDictionary([out] IDispatch** pDictionary);
>    [id(0x12345678)]

Unusual ([out] is generally [out,retval]) but OK.

> >     dic = ob.getDictionary()
>
> Yes, I am able to call this way using the generated classes, and also
> without...  This is what happens:
>
> >>> dic = ob.getDictionary()
> >>> dic
> <COMObject getDictionary>

That type for dic sounds strange, and I'm also surprised you
say this works at all WITHOUT makepy support.

> I find this strange...getDictionary is just the method, in VB I here
> get an instance of the IDictionary, which has the getValue method
> I need (IDictionary is a subclass of IDispatch).  This is what
> happens now:
>
> >>> val = dic.getValue('Version')
> Traceback (innermost last):
>   File "<interactive input>", line 1, in ?
>   File "C:\Python20\win32com\client\dynamic.py", line 435, in
> __getattr__
>     raise AttributeError, "%s.%s", % (self._username_, attr)
> AttributeError: getDictionary.getValue
> >>>
>
> Not unexpected, as getDictionary does not have a getValue method....
>
>
> So, what is going on here?  Any idea?

What happens if you do a dir(dic.__class__) -- what methods
does this class expose?  IS it a makepy-generated class?  If
it isn't, then there's some trouble brewing.


Alex






More information about the Python-list mailing list