472,993 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 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 975

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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.