[python-win32] Can win32com handle this one?

Tim Golden mail at timgolden.me.uk
Tue Feb 5 09:59:04 CET 2008


Tim Golden wrote:
> David Abrahams wrote:
>> on Mon Feb 04 2008, "Mark Hammond" <mhammond-AT-skippinet.com.au> wrote:
>>> 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, 
>> Hmm, thanks, I guess it doesn't:
>>
>>      'PyIUnknown' object has no attribute 'GetTypeInfo'
>>
>>> in which case you could then start calling methods etc on it.
>> So I guess I need to resort to wrapping the C++ API into an extension
>> module.
> 
> Worth looking at comtypes. As long as the interface isn't too
> abstruse you can define it yourself. (And Thomas Heller, the
> maintainer, is usually pretty responsive on the lists if you're
> stuck).

Meant to add: probably worth using the svn version:

http://svn.python.org/projects/ctypes/trunk/comtypes

TJG


More information about the python-win32 mailing list