PythonCOM arbritrary vtable based interfaces

Sanjay sanjay at
Fri Feb 15 19:38:12 CET 2002

Mark Hammond <mhammond at> wrote in message news:<3C6D08C1.2000307 at>...
> Sanjay wrote:
> > I saw a thread last september stating that this limitation may soon be
> > lifted.  Does the latest release of PythonCOM support this feature? 
> It supports implementing such interfaces, but not calling them.
> > If not, are there any workarounds?  I also saw the suggestion that
> > creating your own pyd to wrap the custom interface would be a good
> > alternative.  Is this still the best way to go?
> For calling interfaces, using SWIG is still the best option - though I 
> would much prefer to bite the bullet and see the universal gateway stuff 
> extended so that we can call those interfaces. :-)
> Mark.

What I am trying to do is something that was somewhat discussed on a
previous thread, but I'm not sure the thought was fully completed. 
Specifically, I would like to write an exchange server event sink by
implementing two com interfaces, IExStoreAsyncEvents and
IExStoreSyncEvents.  The problem I'm having is that when the python
event listener is loaded as a com+ application, and I register this
application for events with exchange, I get the error TypeError ...
IID not supported.  From looking at the previous threads, it seems as
this problem is caused by not being able to handle arbitrary vtable
interfaces, such as the interface methods of IExStoreAsyncEvents and
IExStoreSyncEvents.  If, however,  the two com classes
IExStoreAsyncEvents and IExStoreSyncEvents were defined in a pyd, then
pythoncom would have knowledge of these interfaces, and properly call
my application.

I hope I'm explaining the problem clearly. I am a little confused as
to how to get around this with pythoncom.


By the way, the code sample looks like:

# Methods implemented by the interfaces.
IExStoreAsyncEvents_methods = ["OnSave", "OnDelete"]
IExStoreSyncEvents_methods  = ["OnSyncSave", "OnSyncDelete"]

    # import event sink type library
0, 1, 0, ["IExStoreSyncEvents", "IExStoreAsyncEvents"])
    raise RuntimeError, "could not import event sink type library"

class MyEventListener:
	_public_methods_ = IExStoreAsyncEvents_methods +
	_com_interfaces_ = ['IExStoreAsyncEvents', 'IExStoreSyncEvents']

	_reg_clsid_      = "{D7CDBFB7-7B49-4EA4-9F8E-47152ED86991}"
	_reg_progid_     = "MyEventListener"
	_reg_desc_       = "My Event Listener"

        # IExStoreSyncEvents interfaces	
	def OnSyncSave(self, pEventInfo, strUrl, lFlags):
		# Called by a store when an item is saved.
	def OnSyncDelete(self, pEventInfo, strUrl, lFlags):
		# Called by a store when an item is deleted.


More information about the Python-list mailing list