473,320 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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
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.)

Oct 1 '07 #1
0 990

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael Jordan | last post by:
I'm hoping that someone here can give me some insight into a problem I'm running into with Python, pywin32 and Excel. All-in-all using Python and pywin32 is great but I've run into a strange...
0
by: neblackcat | last post by:
This is a heads-up on a possible memory corruption type of bug in recent and present versions of Python/win32com. I dont know if its general, or specific to using win32com.client to access CDO as...
2
by: Tim N. van der Leeuw | last post by:
Hi, I have some questions specifically about python win32com extensions, and I thought it might be more appropriate to ask them on a mailing list / newsgroup / webforum etc. dedicated to that....
1
by: Philippe C. Martin | last post by:
Hi, I just got the pywin32 "hello world" COM server to install and I did manage to use it from VB 6.0. However, there are some glitches I do not comprehend: 1) at one point I got a python...
13
by: sushant | last post by:
hi; the code: int main(void) { float i=6.10203; printf("%d",i); return 0; }
0
by: Do Re Mi chel La Si Do | last post by:
Hi! I had found (since only 2 hours) that KixForm can to do used by Python + PyWin32 At the end of the message, a very small example It's an Active-X, in one file (.DLL), and one help-file...
2
by: kogrover | last post by:
ISSUE: COM Excel Sort works with Early Binding, but not Late Binding, but py2exe only does Late Binding I have code similar to this (type from notes, so there may be a typo...) import...
0
by: Andrea Gavana | last post by:
Hi All, I have a very simple python script that tries to put a rectangular shape in a worksheet and then add some text inside that shape. The main problem, is that as usual Excel doesn't like...
1
by: kernel1983 | last post by:
By reading the doc of pywin32 we can invoke COM like: o = win32com.client.Dispatch("Excel.Application") but is it possible to invoke some GUID directly?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.