[python-win32] Problem passing array by reference

Tim Roberts timr at probo.com
Thu Jul 17 21:26:49 CEST 2014


Marco Nawijn wrote:
>
> Your answer implies that they are not declared correctly, because the
> parameter is really required. It throws an exception with "invalid
> number of parameters" if you leave it out.

Many people write their COM objects so that they work from C++ without
giving a rip about the rules that allow them to play nicely with other
languages.

Do you get one return value, or two?  Perhaps they have written it so it
looks like an in/out parameter.  If so, the modified array would be the
second return value.


> If the type is somehow not declared correctly, is there a workaround?

An EASY workaround?  No.  With the comtypes package, you can force
Python to call almost any interface that can be designed by the
perverted mind, but it's not automatic.  It means you have to write
accurate declarations for all of the methods yourself.  There are good
examples on the interwebs, but if you don't have good documentation to
begin with, it will be painful.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list