[python-win32] Makepy does not generate all secondary interfaces?

Åsmund Hjulstad asmund.hjulstad at gmail.com
Fri Nov 19 08:05:55 CET 2010


2010/11/17 Mark Hammond <skippy.hammond at gmail.com>:
> On 16/11/2010 7:49 PM, Åsmund Hjulstad wrote:
>>
>> I am guessing the problem is that the library does not declare that the
>> any classes implement these secondary interfaces.
>
> It should iterate over every interface in the .idl file - see
> BuildOleItemsFromType in genpy.py (and maybe some "print debugging" in that
> file will help you see what is going on)

It finds the interface, and calls

oleItem, vtableItem = self._Build_Interface(type_info_tuple)

however, with bForDemand = True, the generated module does not have
members matching the interface. With bForDemand = false, it works.


As an example, with an emtpy gen_py directory, the following code
works for me, but changing to bForDemand = True does not.

pisdk = gencache.EnsureModule('{0EE075CE-8C31-11D1-BD73-0060B0290178}',
0, 1, 1,
                bForDemand = False)
medlemmer = pisdk.__dict__
for k,v in medlemmer.iteritems():
    if k.startswith("IPIData2"):
        print k

# This prints   (only when bForDemand=False)
# IPIData2
# IPIData2_vtables_dispatch_
# IPIData2_vtables_

pis = Dispatch("PISDK.PISDK")
servernavn = "st-w240"
server = pis.Servers(servernavn)
tag = server.PIPoints('TT-20130/Meas1/PRIM')
data = tag.Data
data2 = pisdk.IPIData2(data)   # with bForDemand=True, I get an exception here
verdier = data2.InterpolatedValues2('*-1h','*','10m',asynchStatus=None)
for v in verdier: print(v)


I have not looked into how changing bForDemand would affect this, but
am happy so far with the "old" behaviour.

As a sidenote, the other secondary interface I have been struggling
with, IPIAsynchStatus2, still does not work, regardless of the
setting. It finds the interface, but

oleItem, vtableItem = self._Build_Interface(type_info_tuple)

returns a None oleItem.  (don't know why, though.)

Thank you very much for your help, the stuff I need is working now.
Please let me know if more debugging is of interest to you.

Åsmund


More information about the python-win32 mailing list