[python-win32] COM Events and Type libraries

Mark Hammond mhammond at skippinet.com.au
Wed Jun 8 06:19:32 CEST 2005


> I've been having a devil of a time trying to get events
> working in win32com with an attached Type library.  It seems
> like I'm missing something obvious, but I haven't been able
> to figure it out.  So I'd like to ask your collective wisdom!
>
> My code is at: http://www.teuton.org/~sholloway/pyTestEvents.zip

Yeah, you have struct a few limitations in the win32com universal support.
There are a few key bugs:
* If an unknown interface name was requested, universal.py would get a None
but fail to treat it as an error.  The interface entries used by universal
must be interface *names* - you were passing an IID as a string, so looking
up this interface name failed.

* Even if we get past that, you will strike a problem when you attempt to
have a real IID in _com_interfaces_ - a type error as we attempt to use that
as a string interface name as described above.

You may be able to work around it by having _com_interfaces_ have only the
interface names from the typelib, and implementing a _query_interface_
method on your object to support the connection-point interfaces.

In the meantime I will fix this in win32com - I'll mail the changed .py
files personally.

Mark



More information about the Python-win32 mailing list