[python-win32] Problem passing array by reference

Marco Nawijn nawijn at gmail.com
Thu Jul 17 20:36:31 CEST 2014


Hi Tim,

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.

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

Marco



On Thu, Jul 17, 2014 at 7:36 PM, Tim Roberts <timr at probo.com> wrote:

> Marco Nawijn wrote:
> >
> > I am facing a problem passing an array by reference. It is exactly the
> > same problem as described in this thread:
> >
> > https://mail.python.org/pipermail/python-win32/2002-November/000562.html
> >
> > In short, I have a valid reference to a Position object. This object
> > has two methods,
> > GetComponents and SetComponents that each take a CATSafeArrayVariant as
> > an argument. This CATSafeArrayVariant should in this case be a
> > one-dimensional
> > array of real values.
>
> If these are declared correctly in their type library, then the array
> should be an output value, and Python's machinery knows how to handle
> that.  So:
>
>     hr, bfr = obj.GetComponents()
>     hr = obj.SetComponents(bfr)
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20140717/0c3a6818/attachment.html>


More information about the python-win32 mailing list