Pythoncom early binding puzzle

Paul Keating google at prodigycomputing.com
Mon Sep 20 08:40:21 EDT 2004


I want my Python COM object to do early binding. I have this working
for methods that return floats and dates and variants, but not for
methods that return COM objects. They are returning IDispatch objects
and not the specific COM objects that the client code is expecting.

I've got to the point that makepy reads my type library and generates
this class:

class IArena_MarketDataServer_CurrenciesData(DispatchBaseClass):
#This class is creatable by the name
'Arena_MarketDataServer_CurrenciesData.189'
  CLSID = IID('{E15E5C42-1B3F-4815-B434-FA9BBAB5B62E}')
  coclass_clsid = IID('{FD32DD22-3A89-430E-8FB9-EDC35852721A}')

  ... (method definition here) ...

  _prop_map_get_ = {}
  _prop_map_put_ = {}

But I still seem to get an IDispatch object, whether I do late
binding:

>>> currenciesData =
win32com.client.Dispatch('Arena_MarketDataServer_CurrenciesData')
>>> currenciesData
<COMObject Arena_MarketDataServer_CurrenciesData>

or try to force early binding:

>>> gencache.EnsureModule('{2A4EEEBF-907A-4038-A7DA-FE299AB491B1}', 0,
1, 8)
<module 'win32com.gen_py.2A4EEEBF (etc)' from
'(path)\2A4EEEBF...x0x1x8.py'>
>>> currenciesData =
win32com.client.Dispatch('Arena_MarketDataServer_CurrenciesData')
>>> currenciesData
<COMObject Arena_MarketDataServer_CurrenciesData>

The second time, it should be something like
<win32com.gen_py.Arena_MarketDataServer 1.8(.9) Type
Library.Arena_MarketDataServer_CurrenciesData>

I've checked the GUIDs, they are ok. Any suggestions on what error
this symptom indicates?



More information about the Python-list mailing list