pywin32/win32com float/double coercion

M

mazerj2006

I'm an old hand at python, but totally new to win32com -- I've run
into a snag that seems to be related to python's (usually handy) lack
of
distinction between floats and doubles. Can anyone explain to me (or
point me towards the right docs) how the win32com module handles an
ActiveX component that returns or expects an array of SINGLE precision
floats (ie, 32-bit floats)?

I'm using a vendor-supplied ActiveX component with two related API
calls that use variant arrays:
vector = ReadDataV(...)
WriteDataV(vector)

ReadData() correctly returns a tuple of floats when called from python
via win32com. However, WriteDataV() expects a vector of single
precision floats, but it seems like the win32com coercion mechanism is
passing in doubles (or at least after a few days of banging my head
against this, I'm convinced that's what's going on).

Basically the following results in garbage getting sent to the
component:
x = ReadDataV()
WriteData(x)

Can anyone point me in the right direction for fixing this problem? Is
there a way to force win32com to use single precision when passing in
floating point arrays?

Thanks,
/jamie

(please CC me a copy of any replies -- I'm WAY behind on c.l.p.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top