[python-win32] default_interface missing

Mantila Juhani Juhani.Mantila@novogroup.com
Mon, 6 May 2002 09:40:44 +0300


Got it the same way.
I've got a huge type library from ESRI and most of the interface
classes are not wrapped by makepy, so most of the coclasses
look similar, no interfaces at all.
In VB and MS VC++ everything is visible and usable...
Some more information, yet. The library is imported into C++
like this :

#ifndef _IMPORTED_
#define _IMPORTED_

#pragma warning(push)
#pragma warning(disable : 4146)
#pragma warning(disable : 4192)

#import "d:\esri\arcexe81\bin\esriCore.olb" raw_interfaces_only,
raw_native_types, no_namespace, named_guids, exclude("OLE_HANDLE",
"OLE_COLOR")

#pragma warning(pop)

#endif


The final question is the same as Andrew's.

Juhani

> -----Original Message-----
> From: Andrew Bennetts [mailto:andrew-pywin32@puzzling.org]
> Sent: Monday, May 06, 2002 8:44 AM
> To: python-win32@python.org
> Subject: [python-win32] default_interface missing
> 
> 
> 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-4
> 728-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-4
> 728-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.
> 
> 
> 
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>