comtypes
Dears,
I am not sure I am at right place here. Now I've started working with comtypes
1.1.0 package within python 2.7.6.1. I have ActiveX COM object I want access
and work with it.
I do following
>> from comtypes.client import CreateObject
>> fm = CreateObject("MCB.PCM")
>> dwt = fm.ReadVariable("dwt")
>> print dwt
(,
,
, True)
by using print gives me return values. I want to access return data (array)and
variable. How can I correctly handle it?
I would you be very thankful for your help.
Thank you
Peter
ReadVariable = [Variant, Variant, Variant, Variant] ReadVariable(handle,
Variant)
--
https://mail.python.org/mailman/listinfo/python-list
Re: python 3.44 float addition bug?
On 2014-06-21, FraserL wrote: > I'm not hugely accustomed to Python, but this seems crazy to me. Both are producing the same floating point numbers, Python just changed the way they're printed. One version doesn't show you all the digits, the other does. -- Grant -- https://mail.python.org/mailman/listinfo/python-list
Re: comtypes
In <[email protected]> [email protected] writes: > >> print dwt > (, > , > , True) > > by using print gives me return values. I want to access return data > (array)and variable. How can I correctly handle it? You can use help() and dir() to display more information about an object. -- John Gordon Imagine what it must be like for a real medical doctor to [email protected] 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list
Re: comtypes
Hmm, I did that - oleviewer says [id(0x60020002)] HRESULT ReadVariable( [in] VARIANT bsVar, [out, optional] VARIANT* vValue, [out, optional] VARIANT* tValue, [out, optional] VARIANT* bsRetMsg, [out, retval] VARIANT* pOk); ipython >>help(fm.ReadVariable) Help on method ReadVariable in module ctypes: ReadVariable(...) method of comtypes.POINTER(IMcbPcm) instance Still I try to figure out how to handle it in python Peter On Saturday, June 21, 2014 6:34:34 PM UTC+2, John Gordon wrote: > In <[email protected]> > [email protected] writes: > > > > > >> print dwt > > > (, > > , > > , True) > > > > > > by using print gives me return values. I want to access return data > > > (array)and variable. How can I correctly handle it? > > > > You can use help() and dir() to display more information about an object. > > > > -- > > John Gordon Imagine what it must be like for a real medical doctor to > > [email protected] 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list
Re: comtypes
Am 21.06.2014 09:08, schrieb [email protected]: Dears, I am not sure I am at right place here. Now I've started working with comtypes 1.1.0 package within python 2.7.6.1. I have ActiveX COM object I want access and work with it. I do following from comtypes.client import CreateObject fm = CreateObject("MCB.PCM") dwt = fm.ReadVariable("dwt") print dwt (, , , True) by using print gives me return values. I want to access return data (array)and variable. How can I correctly handle it? dwt apparently is an array containing pointers to VARIANTs. In comtypes (or ctypes) you dereference pointer by indexing them with zero. So something like this could work: for item in dwt: print item[0] Thomas -- https://mail.python.org/mailman/listinfo/python-list
Re: comtypes
I uses pywin32
>>> import win32com.client
>>> fm = win32com.client.Dispatch("MCB.PCM")
>>> fm.ReadVariable('dwt')
(True, 0.0250037252903, u'0.025', u'')
and I am getting it OK.
Now I am trying to add and register event handler and no luck yet :(
>>> ev = win32com.client.WithEvents(fm, evnt)
class evnt:
def OnEvent(self):
print "Hello..."
it does not work... I would like to know correct way to register event - any
idea?
Thank you very much.
On Saturday, June 21, 2014 8:17:23 PM UTC+2, Thomas Heller wrote:
> Am 21.06.2014 09:08, schrieb [email protected]:
>
> > Dears,
>
> >
>
> > I am not sure I am at right place here. Now I've started working with
> > comtypes 1.1.0 package within python 2.7.6.1. I have ActiveX COM object I
> > want access and work with it.
>
> >
>
> > I do following
>
> >>> from comtypes.client import CreateObject
>
> >>> fm = CreateObject("MCB.PCM")
>
> >>> dwt = fm.ReadVariable("dwt")
>
> >>> print dwt
>
> > (,
> > ,
> > , True)
>
> >
>
> > by using print gives me return values. I want to access return data
> > (array)and variable. How can I correctly handle it?
>
>
>
> dwt apparently is an array containing pointers to VARIANTs. In
>
> comtypes (or ctypes) you dereference pointer by indexing them with zero.
>
> So something like this could work:
>
>
>
> for item in dwt:
>
> print item[0]
>
>
>
> Thomas
--
https://mail.python.org/mailman/listinfo/python-list
Re: python 3.44 float addition bug?
In article , Chris Angelico wrote: > Also, when you're looking at how things print out, consider looking at > two things: the str() and the repr(). Sometimes just "print(p)" > doesn't give you all the info, so you might instead want to write your > loop thus: > > z = 0.01 > p = 0.0 > for i in range(19): > p += z > print(str(p) + " -- " + repr(p)) > Sometimes you can get extra clues that way, although in this instance > I think you won't. Actually, I think this is one case where you would get extra clues (or extra headscratching) if you run the code with various releases of Python. $ python2.6 b.py 0.01 -- 0.01 0.02 -- 0.02 0.03 -- 0.02 0.04 -- 0.040001 0.05 -- 0.050003 0.06 -- 0.060005 0.07 -- 0.070007 0.08 -- 0.080002 0.09 -- 0.089997 0.1 -- 0.02 0.11 -- 0.10999 0.12 -- 0.11998 0.13 -- 0.12998 0.14 -- 0.13999 0.15 -- 0.14999 0.16 -- 0.16 0.17 -- 0.17001 0.18 -- 0.18002 0.19 -- 0.19003 $ python2.7 b.py 0.01 -- 0.01 0.02 -- 0.02 0.03 -- 0.03 0.04 -- 0.04 0.05 -- 0.05 0.06 -- 0.060005 0.07 -- 0.07 0.08 -- 0.08 0.09 -- 0.09 0.1 -- 0.0 0.11 -- 0.10999 0.12 -- 0.11998 0.13 -- 0.12998 0.14 -- 0.13999 0.15 -- 0.15 0.16 -- 0.16 0.17 -- 0.17 0.18 -- 0.18002 0.19 -- 0.19003 $ python3.4 b.py 0.01 -- 0.01 0.02 -- 0.02 0.03 -- 0.03 0.04 -- 0.04 0.05 -- 0.05 0.060005 -- 0.060005 0.07 -- 0.07 0.08 -- 0.08 0.09 -- 0.09 0.0 -- 0.0 0.10999 -- 0.10999 0.11998 -- 0.11998 0.12998 -- 0.12998 0.13999 -- 0.13999 0.15 -- 0.15 0.16 -- 0.16 0.17 -- 0.17 0.18002 -- 0.18002 0.19003 -- 0.19003 What's going on here is that in Python 2.7 the repr() of floats was changed to use the minimum number of digits to accurately roundtrip the number under correct rounding. For compatibility reasons, the str() representation was not changed for 2.7. But in Python 3.2, str() was changed to be identical to repr() for floats. It's important to keep in mind that the actual binary values stored in float objects are the same across all of these releases; only the representation of them as decimal characters varies. https://docs.python.org/2.7/whatsnew/2.7.html#other-language-changes http://bugs.python.org/issue9337 -- Ned Deily, [email protected] -- https://mail.python.org/mailman/listinfo/python-list
beginners python mail list
HI there, I have some amateur python questions. Is there a beginners python mail list? Cheers, Noah -- https://mail.python.org/mailman/listinfo/python-list
Re: beginners python mail list
On Sat, Jun 21, 2014 at 8:43 AM, Noah wrote: > Is there a beginners python mail list? > Tutor maillist - [email protected] -- I have seen the future and I'm not in it! -- https://mail.python.org/mailman/listinfo/python-list
Understanding Python Code[Forward_Backward_Wikipedia]
On Friday, June 20, 2014 12:37:01 AM UTC+5:30, Ian wrote:
> On Thu, Jun 19, 2014 at 12:44 PM, wrote:
>
> > Dear Group,
>
> > Generally most of the issues are tackled here, but as I am trying to cross
> > check my understanding I found another question,
>
> >
>
> > f_curr[st] = e[st][x_i] * prev_f_sum
>
> >
>
> > Here, if I give one print command and see the results,
>
> > print "$$2",f_curr
>
> >
>
> > It is showing an iterative update like,
>
> > $$2 {'Healthy': 0.3},
>
> > $$2 {'Healthy': 0.3, 'Fever': 0.04001}
>
> >
>
> > I was trying to ask how the size is being updated, from 1 to 2 back to 1
> > again 2... is it for any loop then which one, I tried to change but not
> > being able
>
> > to if any one of the esteemed members may kindly help me.
>
>
>
> That statement is inside the for loop that builds the f_curr dict. One
>
> state gets calculated on each iteration. The first time it prints, one
>
> state has been added. The second time it prints, two states have been
>
> added. You only have two states, so at that point the loop is done.
>
> The next time it prints, it's on the next iteration of the outer (i,
>
> x_i) loop and it's building a new f_curr dict. So then you see it
>
> adding one state and then the second state to the new dict. And so on
>
> and so forth until the outer loop completes.
Dear Group,
Thank you for the kind help. I could solve other portions of the code easily.
As this algorithm is an important algorithm so is its Wikipedia note, so I
changed subject line bit, in case future users try to solve any questions, they
may get the helps.
Thank you again especially to Ian.
Regards,
Subhabrata Banerjee.
S
--
https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Nevow 0.11.1
Hello, I'm pleased to announce the release of Nevow 0.11.1. Nevow is a web application construction kit written in Python and based on Twisted. It is designed to allow the programmer to express as much of the view logic as desired in Python, and includes a pure Python XML expression syntax named stan to facilitate this. However it also provides rich support for designer-edited templates, using a very small XML attribute language to provide bi-directional template manipulation capability. This release includes a number of minor new features and bug fixes. It also includes changes to modernize Nevow's packaging - installation of Nevow using `pip` is now supported. This release also marks the move of Nevow development to Github. You can read about all of the changes in this release in the NEWS file: https://github.com/twisted/nevow/blob/release-0.11.1/NEWS.txt You can find Nevow on PyPI: https://pypi.python.org/pypi/Nevow Or on Github: https://github.com/twisted/nevow Enjoy! Jean-Paul http://as.ynchrono.us/ -- https://mail.python.org/mailman/listinfo/python-list
py2app dependency determination?
Hi, trying to get py2app to work. It keeps saying that we need Pillow-PIL, which is wrong. And, anyways, Pillow-PIL fails to install. The program works fine as a normal python script, and it doesn't use Pillow- PIL. Any ideas? thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: py2app dependency determination?
On Sat, 21 Jun 2014 16:50:22 -0800, john wrote:
> Hi, trying to get py2app to work. It keeps saying that we need
> Pillow-PIL, which is wrong. And, anyways, Pillow-PIL fails to install.
>
> The program works fine as a normal python script, and it doesn't use
> Pillow- PIL. Any ideas?
Yes.
(1) Since this is specifically a py2app issue, you may have better
results from asking on a dedicated py2app mailing list.
(2) Is it possible that Pillow or PIL is a dependency of py2app, and the
error has nothing to do with your script at all? What happens if you run
py2app on a minimal script like this?
# hello.py
print("hello world")
(3) If not, please post a minimal set of steps that demonstrates the
problem, and the *exact* error message generated (if possible). For
example:
Download py2app version 1.3 from http://some.place.com
Run the py2app installer.
Create a minimal script hello.py (as above)
Run py2app hello.py
The result is ... [whatever actually happens]
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
How to distribute python console program
I have a simple program that is ran in the console with 2 modules and i was wondering how i could like export it so i could give it to someone to use as like a utlitie in the console? -- https://mail.python.org/mailman/listinfo/python-list
