We are having occasional difficulties when we need to pass an argument 
in-and-out of a COM method that we are calling in Python.  There is some magic 
in makepy that normally handles this for us but occasionally it fails because 
it somehow reads the typelib incorrectly and misunderstands the data type it 
must create.  Specifically, I have a C++ method exposed to COM and it expects 
an empty SafeArray of two elements (double floats) to be passed as an argument. 
 That method revises the array, filling it with two values.  We have found that 
makepy assigns some sort of identifier to each data type.  For instance an 
array of strings is assigned (24584, 3) and an array of variants is assigned 
(24588, 3) as shown in the line of code below, taken from one of the wrappers 
created by Makepy.

def GetDirection(self, oDirection=(0,0)):
              return self._ApplyTypes_(1611137025, 1, (24, 0), ((24588,3),), 
u'GetDirection', None, oDirection)

Occasionally pywin32 assigns the wrong identifier then the argument is cast as 
the wrong data type and an error is thrown.  We stumbled upon the correct 
identifier and when we corrected the identifier assigned by Makepy then we were 
able to call the method without throwing an error.  Where can we find a list of 
these identifiers?

Mike Fox

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to