[python-win32] default_interface missing

Andrew Bennetts andrew-pywin32@puzzling.org
Mon, 6 May 2002 15:43:58 +1000


Hi,

I'm getting the following error trying to instantiate a COM object:

---
Traceback (most recent call last):
  File "<pyshell#24>", line 1, in ?
    mod.WLXMLWriter()
  File "C:\Python22\lib\site-packages\win32com\gen_py\2F7F6580-4166-4728-B165-361888BBAF93x0x1x0.py", line 26, in __init__
    self.__dict__["_dispobj_"] = self.default_interface(oobj)
  File "C:\Python22\lib\site-packages\win32com\gen_py\2F7F6580-4166-4728-B165-361888BBAF93x0x1x0.py", line 32, in __getattr__
    d=self.__dict__["_dispobj_"]
KeyError: _dispobj_
---

The problem seems to be that default_interface isn't defined in the
module generated by makepy, causing a dud call to
CoClassBaseClass.__getattr__ to find it:

---
# This CoClass is known by the name 'WLXML.WLXMLWriter.1'
class WLXMLWriter(CoClassBaseClass): # A CoClass
    # WLXMLWriter Class
    CLSID = pythoncom.MakeIID("{5625CFA5-A60F-408D-A26D-19D39A58B38D}")
    coclass_sources = [
    ]
    coclass_interfaces = [
    ]

    ### default_interface = XXX  should go here?
---

Is this a bug in win32com or in the COM object?

-Andrew.