All the other comments in this thread are correct, but one other thing you can do in recent pywin32 builds is to use win32com.client.VARIANT to override how a value is passed - search for 'win32com.client.VARIANT' in pywin32.chm for basic docs.

HTH,

Mark

On 21/07/2012 1:55 PM, Fox, Michael K wrote:
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


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

Reply via email to