PythonCOM arbritrary vtable based interfaces

Sanjay sanjay at jarna.com
Fri Feb 15 13:38:12 EST 2002


Mark Hammond <mhammond at skippinet.com.au> wrote in message news:<3C6D08C1.2000307 at skippinet.com.au>...
> 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.

Sanjay

By the way, the code sample looks like:

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

try:
    # import event sink type library
    universal.RegisterInterfaces('{1F28FCC2-8B0D-11D2-9C95-00C04F79F1DB}',
0, 1, 0, ["IExStoreSyncEvents", "IExStoreAsyncEvents"])
except:
    raise RuntimeError, "could not import event sink type library"

class MyEventListener:
	_public_methods_ = IExStoreAsyncEvents_methods +
IExStoreSyncEvents_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.
		pass
	
	def OnSyncDelete(self, pEventInfo, strUrl, lFlags):
		# Called by a store when an item is deleted.
		pass

        ...



More information about the Python-list mailing list