[python-win32] win32com does not recognise an Interface for events
Mark Hammond
mhammond at skippinet.com.au
Tue Aug 7 20:21:39 CEST 2007
> OLE Viewer finds a second interface IS7ProSimEvents that is
> made the default source makepy does not recognise
> IS7ProSimEvents as an interface at all.
That seems strange - for events, even non-dual interfaces should be
supported.
> gencache.GetClassForCLSID(clsid) returns the class with
> docstring """IS7ProSim Interface for S7ProSim COM Object"""
> This is correct.
> This class has no sources, as can be seen in the OLE Viewer
> output, and the AttributError is thrown. OK.
> klass.coclass_clsid is '{83CC0D83-FEDA-11D1-BE76-0060B06816CF}'. OK.
> gencache.GetClassForCLSID(klass.coclass_clsid) returns a
> class with the following properties:
> base class : CoClassBaseClass
> coclass_interface : [<class
> win32com.gen_py.83CC0D80-FEDA-11D1-BE76-0060B06816CFx0x1x0.IS7
> ProSim at
> 0x00E4DCF0>]
> coclass_sources : []
> clsid : {83CC0D83-FEDA-11D1-BE76-0060B06816CF}
> There is no attribute default_source, so the AttributeError
> is thrown again.
>
> This is correct with respect to the makepy output, but not
> with repsect to the actual OLE object.
> IMHO the makepy output should have included IS7PrSomEvents as
> an interface and declared it as default_source within CoClass
> S7SimPro. Right?
Yep - so presumably this is the same problem as above.
> So how come it does not?
No idea.
> Tracking the makepy actions:
> ----------------------------
> A convenient break point location is makepy.py line 263:
> gen.generate(....) Walking on till genpy.py line 737
> self.CollectOleItemInfosFromType()
> returned a (correct) list
> of all OleItem information headers:
> infotype doc[0]
> doc[1]
> TKIND_INTERFACE, 'IS7ProSimEvents', 'Event interface for
> S7ProSim COM Object'
> TKIND_COCLASS, 'S7ProSim', 'S7ProSim Class'
> TKIND_DISPATCH, 'IS7ProSim', 'IS7ProSim
> Interface
> for S7ProSim COM Object'
> a number of (infotype 0 and 6) entries for the constant
> enumerations This list is run through to colelct and build
> all oleItems, enumItems, recordItems and vtableItems
> pass 0: TKIND_INTERFACE, 'IS7ProSimEvents', 'Event interface
> for S7ProSim COM Object'
> oleItem, vtableItem =
> self._Build_Interface(type_info_tuple)
> returns (None, <VTableItem>)
> returns (None, <VTableItem>). This will lead to
> the exclusion of this interface later on.
>
> So how does this happen?
It would appear that makepy is excluding non-dual interfaces, and that the
integration with the 'universal' support for vtable interfaces isn't
complete.
> Did I stumble on a bug here or am I completely missing a
> point? Please help out.
I think you struck a bug - we should be able to support incoming interfaces
(ie, events) using only vtables.
Mark
More information about the python-win32
mailing list