PythonCOM arbritrary vtable based interfaces
Sanjay
sanjay at jarna.com
Mon Feb 18 18:05:40 EST 2002
Mark Hammond <mhammond at skippinet.com.au> wrote in message news:<3C6DAF39.5080808 at skippinet.com.au>...
> Sanjay wrote:
> > 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.
>
> You need t6o check out the win32com\servers\test_pycomtest.py. This
> shows how arbitary vtables must be loaded by your code before it is
> recognized. This in-turn implies that the interface is described in a
> type library.
>
> Mark.
Ok, I looked at test_pycomtest.py and changed my interface to match,
i.e. I set _public_methods_ to an empty list, _com_interfaces_ to
"[IExStoreSyncEvents]", I created a new _reg_clsid_ value, and
implemented the two methods in the interface. I then registered the
class using register.UseCommandLine() with debugging turned on. Then
I told Exchange to notify this object when new events happen. In the
windows Event viewer, I now see the following error when events occur
in Exchange and it tries to call my python com object:
Exception: C0000005
Address: 0x1E12E6A5
Call Stack:
python22!PyDict_Next + 0xC5
ole32!StringFromCLSID + 0xB91
...
...
There doesn't seem to be anything strange in the Python Trace
Collector window. I see a message saying "Object with win32trace
dispatcher created (object=None)", followed by 3 calls to
QueryInterface with unsupported IIDs (Unregistered, ISTdMarshalInfo,
and IExternalConnection) which are all interfaces I should not need
implemented here.
Any idea what the problem is?
Sanjay
More information about the Python-list
mailing list