[python-win32] COM array problem

Reinier Heeres reinier at heeres.eu
Tue Jul 28 20:29:39 CEST 2009


Hi everybody,

I have a problem with a function of a COM object that is supposed to
return an array of data. The function prototype generated by
win32com's EnsureDispatch is as follows:

def GetFrame(self, frame=defaultNamedNotOptArg,
FrameVariant=defaultNamedNotOptArg):
    """Get Frame Data"""
    return self._ApplyTypes_(10, 1, (24, 0), ((2, 1), (16396, 3)),
u'GetFrame', None,frame
        , FrameVariant)

which from my understanding means that the type which gives the
problem is VT_R4 | VT_BSTR | VT_BYREF. (I've seen problems with byref
return values before on the mailing list archives, but I don't know if
they apply here).

The error is slightly undescriptive (snipped a part):

    454         def _ApplyTypes_(self, dispid, wFlags, retType,
argTypes, user, resultCLSID, *args):
    455                 return self._get_good_object_(
--> 456                         self._oleobj_.InvokeTypes(dispid, 0,
wFlags, retType, argTypes, *args),
    457                         user, resultCLSID)
    458

com_error: (-2147352567, 'Exception occurred.', (0, None, None, None,
0, -2147024809), None)

I don't exactly understand where the problem is: is it before the call
to the actual COM function while creating an empty object, in the COM
call, or after the call casting the result? Any ideas on how to fix
this would be welcome; I could try to make patches for win32com.

BTW: I can get it to work with comtypes (but that gives problems on
some other calls), so in principle it should be possible.
Unfortunately I don't have access to the source of the COM object I'm
using.

I'm using pywin32-212 and python 2.5.1.

Regards,
-- 
Reinier Heeres
Tel: +31 6 10852639


More information about the python-win32 mailing list