[python-win32] Can win32com handle this one?

Mark Hammond mhammond at skippinet.com.au
Mon Feb 4 23:47:00 CET 2008


> I have a couple of type libraries that I've run makepy on.
> 
> The first can be loaded with
> 
>   s = win32com.client.Dispatch('nameof.Lib1')
> 
> I have verified that the above gets the ILib1Session object, which
> the documentation for that library says is the entry point for
> everything.
> 
> The documentation then states I'm to call the GetProvider method to get
> an instance of ILib2Provider, which, naturally, is defined in Lib2.
> The
> GetProvider method is declared thus:
> 
>   HRESULT GetProvider (
>    ILib2Provider   **ppProvider)
> 
> When I do

Unfortunately, win32com doesn't support arbitrary interfaces.  If the object
you are using doesn't support IDispatch, then you can't use it from
win32com.  You may like to try something like:

ob = win32com.client.Dispatch(s.GetProvider())

to see if it does support IDispatch, in which case you could then start
calling methods etc on it.

Mark



More information about the python-win32 mailing list