[python-win32] Variant ByRef 2D array returned as 1D array

Mark Hammond mhammond at skippinet.com.au
Wed Aug 16 17:01:27 CEST 2006


> I'm working with a COM module that is returning a 2D array as a
> VARIANT BYREF. The 2D array is 30x8 (with each entry being 1 byte)
> When the data is returned I'm getting a buffer of length 30. This
> tells me that win32com only sees 1D of the array (documentation states
> that the buffer is expected for variants-byref with entries of 1
> byte). Any ideas on why win32com doesn't see that there is really an
> array of arrays?

If the type of one dimension is VT_UI8, then pythoncom will treat that as a
'byte buffer', so will return a string - in which case you will simply need
to pretend the string is actually an array of bytes!  Otherwise you are
probably going to need to help create a test case so I can see exactly what
is going on - what language is this object implemented in, and is the source
available?  We have test COM objects written in VB and C, so creating a test
case shouldn't be too hard.

Cheers,

Mark



More information about the Python-win32 mailing list