[python-win32] Problem passing array by reference

Marco Nawijn nawijn at gmail.com
Thu Jul 17 22:51:45 CEST 2014


Hi Tim,

Ok. I will give it a try and report back. I did a quick search and
found the TLB files. Never worked with them though, but I will
take a look.

Marco


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

> Marco Nawijn wrote:
> > Ok. Another clue (slightly blushing that I didn't notice this before..).
> > I focus on the Position.GetComponents(...) for the moment.
> > Recall that this should set the orientation (9 values) and the
> > position (3 values) by means of an array passed in by reference.
> >
> > To my surprise, it returns the same numbers as I put in. So, the
> > following is happening in the terminal:
> > >>> l = range(12)
> > >>> res = p1.Position.GetComponents(l)
> > >>> print res
> > (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
> >
> > The values though are incorrect, I also tried with floats, but the
> > result is the same. I get back an exact copy of what I put in.
>
> That's too bad.  That should have been able to work.
>
>
> > Regarding the workaround, can I mix comtypes and win32com?
> > So, can I only (try) to use comtypes to let this call succeed?
> > All other calls I have tried work flawlessly with win32com.
>
> I'm not sure I can give you a definitive answer.  There is a fair amount
> of overlap between them.  You do see sample code on the web that mixes
> the two, but you're talking about passing an interface between them, and
> that seems awkward.  You probably have experimentation ahead of you.
>
> I don't know how extensive is the code you've already done.  Comtypes
> can do everything Pythoncom can do; you may find that it is not that
> hard to convert, especially if you have a TLB.
>
> --
> 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/c08ed6d9/attachment.html>


More information about the python-win32 mailing list