471,317 Members | 2,606 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

pywin32/win32com float/double coercion

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
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(...)

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
x = ReadDataV()

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?


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

Oct 1 '07 #1
0 912

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Michael Jordan | last post: by
reply views Thread by neblackcat | last post: by
2 posts views Thread by Tim N. van der Leeuw | last post: by
1 post views Thread by Philippe C. Martin | last post: by
13 posts views Thread by sushant | last post: by
reply views Thread by Do Re Mi chel La Si Do | last post: by
reply views Thread by Andrea Gavana | last post: by
1 post views Thread by kernel1983 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.