Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Marko Rauhamaa
BartC : > And no one has the answered the question of how Curses or a GUI solves > the problem of getting char or key events. Same machine, same OS, same > keyboard, but one piece of software has apparently discovered the > secret which is then denied to other software. Curses, emacs, vi, bash, CP

Re: UDP decode

2016-10-25 Thread Chris Angelico
On Wed, Oct 26, 2016 at 2:19 PM, wrote: > b'/osceleton2/joint\x00\x00\x00,siid\x00\x00\x00head\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05C\xec\xad&C\xa0\x81vDG\x84N?\x80\x00\x00Bu\x7f\xedh5f\x9b' > -- > > > It supouse to be this: >

UDP decode

2016-10-25 Thread julimadoz
Hi! I'm using Kinect with OSCeleton and it is sending the data thru UDP. I can receive it in python, but i can't decode it. I have this: -- import socket UDP_IP = "127.0.0.1" UDP_PORT = 7110 sock = socket.socket(socket.AF_INET, # Internet

Re: how to evaluate a ast tree and change Add to Multiply ?

2016-10-25 Thread meInvent bbird
Hi Jerry, how about custom function? i change to node.op = ast.op2() import ast def op2(a,b): return a*b+a class ChangeAddToMultiply(ast.NodeTransformer): """Wraps all integers in a call to Integer()""" def visit_BinOp(self, node): if isinstance(node.op, ast.Add):

is it possible use python to run another main point or function in some range of memory in executable file

2016-10-25 Thread meInvent bbird
is it possible python to run another main point or function in some range of memory in executable file -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Michael Torrie
On 10/25/2016 10:22 AM, Steve D'Aprano wrote: > So how would you do non-blocking keyboard input? How would it work? What > would be the interface? Curses must allow you to do this because I've seen text-mode games made in curses and you could do things with arrow keys, etc, all while ascii animati

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Terry Reedy
On 10/25/2016 7:45 PM, BartC wrote: On 25/10/2016 23:58, Chris Angelico wrote: Yes, it does. Text does not include "Home" or "Delete", but it does include all manner of symbols that aren't on everyone's keyboards. It makes a huge difference. Actually TXT files can include codes such as Carri

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Steve D'Aprano
On Tue, 25 Oct 2016 09:02 pm, BartC wrote: >> raw_input('Press the Enter key to continue... ') > > Which doesn't work on Python 3. So even here, making it easy by using > line-input, it's not so straightforward. Really, Bart? You're stymied by the change of raw_input() to input() in Python 3? A

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread BartC
On 25/10/2016 23:58, Chris Angelico wrote: On Wed, Oct 26, 2016 at 9:30 AM, BartC wrote: That still doesn't answer the fundamental question: Are you looking for KEYBOARD input or TEXT input? Does it matter that much? Because even if you opt for TEXT, the input (when interactive which is wh

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Travis Griggs
> On Oct 25, 2016, at 5:55 AM, Chris Angelico wrote: > > On Tue, Oct 25, 2016 at 11:45 PM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> On Tue, Oct 25, 2016 at 11:09 PM, Marko Rauhamaa wrote: Blocking calls are evil. >>> >>> Oh, that's why. Got it. So because blocking calls are fund

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Wed, Oct 26, 2016 at 9:30 AM, BartC wrote: >> That still doesn't answer the fundamental question: >> >> Are you looking for KEYBOARD input or TEXT input? > > > Does it matter that much? > > Because even if you opt for TEXT, the input (when interactive which is what > we're talking about) is usu

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread BartC
On 25/10/2016 22:57, Chris Angelico wrote: On Wed, Oct 26, 2016 at 8:24 AM, Marko Rauhamaa wrote: Thankfully, you don't need to run your program from a terminal. You can interpret keyboard events any way you want if your program is an X11 or Wayland client, and forget all about TTYs, baud rate

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Wed, Oct 26, 2016 at 8:24 AM, Marko Rauhamaa wrote: > > Thankfully, you don't need to run your program from a terminal. You can > interpret keyboard events any way you want if your program is an X11 or > Wayland client, and forget all about TTYs, baud rates, parity bits, > hangups etc. That st

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Marko Rauhamaa
Nobody : > On Mon, 24 Oct 2016 11:14:05 -0700, jladasky wrote: >> I gather that non-blocking keyboard input functions aren't the >> easiest thing to implement. They seem to depend on the operating >> system. > > Indeed. It's somewhat harder to implement one on an OS which doesn't > take it for gra

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Nobody
On Mon, 24 Oct 2016 11:14:05 -0700, jladasky wrote: > I gather that non-blocking keyboard input functions aren't the easiest > thing to implement. They seem to depend on the operating system. Indeed. It's somewhat harder to implement one on an OS which doesn't take it for granted that the system

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Wed, Oct 26, 2016 at 3:05 AM, Steve D'Aprano wrote: > On Tue, 25 Oct 2016 11:49 pm, Chris Angelico wrote: > >> In Python, Ctrl-C raises KeyboardInterrupt. If you want to save your >> data, use standard exception handling. (And asking to confirm? Isn't >> that exactly what "Press Enter to contin

Re: Reversing \N{...} notation?

2016-10-25 Thread Peter Otten
Tim Chase wrote: > I like the clarity of using the "\N{...}" notation when creating > string literals involving Unicode chars. > > Is there a built-in way to get such strings back from Python? > > >>> s = 'ma\N{LATIN SMALL LETTER N WITH TILDE}ana' > >>> s > 'mañana' > >>> magic(s) > 'ma\\N{

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Marko Rauhamaa
Steve D'Aprano : > So how would you do non-blocking keyboard input? How would it work? > What would be the interface? https://tronche.com/gui/x/xlib/events/keyboard-pointer/keyboard-pointer.html Marko -- https://mail.python.org/mailman/listinfo/python-list

3rd command never executed in remote machine using paramiko

2016-10-25 Thread mandalmanas786
I have written below code to run 3 command in remote server interactively But when i checked 3rd command never executed and code stuck here is my code def execute(): ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('ipaddress',username='user', passwo

Reversing \N{...} notation?

2016-10-25 Thread Tim Chase
I like the clarity of using the "\N{...}" notation when creating string literals involving Unicode chars. Is there a built-in way to get such strings back from Python? >>> s = 'ma\N{LATIN SMALL LETTER N WITH TILDE}ana' >>> s 'mañana' >>> magic(s) 'ma\\N{LATIN SMALL LETTER N WITH TILDE}ana'

Re: 3.5.2

2016-10-25 Thread Irmen de Jong
On 25-10-2016 2:11, Kenneth L Stege wrote: > Im running windows 7 pro, 64 bit. I downloaded 3.5.2 64 bit and when I try to > run I get the error message api-ms-win-crt-runtime-l1-1-0.dll is missing. I > loaded that file and still will not run. > suggestions? > thanks > http://lmgtfy.com/?q=

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Paul Rubin
jlada...@itu.edu writes: > ... I find myself asking why Python doesn't include a standard, > non-blocking keyboard input function. I have often wanted one myself. I agree this would be useful. Forth has a standard word KEY to read a key, and I used it in a simple game that I wrote a few months a

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Steve D'Aprano
On Wed, 26 Oct 2016 01:36 am, Random832 wrote: > On Tue, Oct 25, 2016, at 02:39, Steven D'Aprano wrote: >> Not really. I think that lots of people think they need it, but >> once they write a little utility, they often realise that it's not >> that useful. That's just my opinion, and I'm one of th

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Steve D'Aprano
On Tue, 25 Oct 2016 11:49 pm, Chris Angelico wrote: > In Python, Ctrl-C raises KeyboardInterrupt. If you want to save your > data, use standard exception handling. (And asking to confirm? Isn't > that exactly what "Press Enter to continue or Ctrl-C to abort" *is*?) $ Fire missiles? Press Enter

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Random832
On Tue, Oct 25, 2016, at 02:39, Steven D'Aprano wrote: > Not really. I think that lots of people think they need it, but > once they write a little utility, they often realise that it's not > that useful. That's just my opinion, and I'm one of those guys who > wrote one: > > http://code.activestat

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Terry Reedy
On 10/24/2016 2:14 PM, jlada...@itu.edu wrote: After reading this rather vague thread... https://groups.google.com/forum/#!topic/comp.lang.python/FVnTe2i0UTY ... I find myself asking why Python doesn't include a standard, non-blocking keyboard input function. I have often wanted one myself. T

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Christian Gollwitzer
Am 25.10.16 um 14:45 schrieb Marko Rauhamaa: Chris Angelico : On Tue, Oct 25, 2016 at 11:09 PM, Marko Rauhamaa wrote: Blocking calls are evil. Oh, that's why. Got it. So because blocking calls are fundamentally evil, we have to... what? What's so bad about them? Remember, not every program

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Tue, Oct 25, 2016 at 11:45 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Tue, Oct 25, 2016 at 11:09 PM, Marko Rauhamaa wrote: >>> Blocking calls are evil. >> >> Oh, that's why. Got it. So because blocking calls are fundamentally >> evil, we have to... what? What's so bad about them? Rem

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Oct 25, 2016 at 11:09 PM, Marko Rauhamaa wrote: >> Blocking calls are evil. > > Oh, that's why. Got it. So because blocking calls are fundamentally > evil, we have to... what? What's so bad about them? Remember, not > every program is a server handling myriad clients.

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Tue, Oct 25, 2016 at 11:35 PM, BartC wrote: > On 25/10/2016 12:25, Chris Angelico wrote: >>> You mean, something as sophisticated as press Enter to continue, or >>> Escape >>> to quit? Or Page Up and Page Down? >> >> >> Enter to continue or Ctrl-C to quit. Just as easy. > > > Ctrl-C is not the

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Marko Rauhamaa
BartC : > Ctrl-C is not the same; that will just abort (without doing proper > termination such as saving your data, or even just asking the user to > confirm). Ctrl-C is not the same, but it does let you intercept it and even ignore it. Just handle signal.SIGINT. > A very basic model of an inte

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Tue, Oct 25, 2016 at 11:09 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> There's a huge difference between a loop that calls a blocking >> function like (raw_)input and one that calls a non-blocking function >> like kbhit(). One of them is polite to other processes; the other is >> not. > >

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread BartC
On 25/10/2016 12:25, Chris Angelico wrote: On Tue, Oct 25, 2016 at 9:02 PM, BartC wrote: raw_input('Press the Enter key to continue... ') Which doesn't work on Python 3. So even here, making it easy by using line-input, it's not so straightforward. So you use input() instead. Big deal. The

3.5.2

2016-10-25 Thread Kenneth L Stege
Im running windows 7 pro, 64 bit. I downloaded 3.5.2 64 bit and when I try to run I get the error message  api-ms-win-crt-runtime-l1-1-0.dll is missing. I loaded that file and still will not run.   suggestions? thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Marko Rauhamaa
Chris Angelico : > There's a huge difference between a loop that calls a blocking > function like (raw_)input and one that calls a non-blocking function > like kbhit(). One of them is polite to other processes; the other is > not. Each process can have its own PTY with a separate virtual keyboard

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Tue, Oct 25, 2016 at 10:14 PM, BartC wrote: > I don't agree. Each single process shouldn't need to be aware of any of the > others. In the same way that the raw_input() example doesn't need to take > account of the other half-dozen Python programs all waiting on raw_input() > at the same time (

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Chris Angelico
On Tue, Oct 25, 2016 at 9:02 PM, BartC wrote: >> raw_input('Press the Enter key to continue... ') > > > Which doesn't work on Python 3. So even here, making it easy by using > line-input, it's not so straightforward. So you use input() instead. Big deal. The concept is still the same. >> If you

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread BartC
On 25/10/2016 11:39, Dennis Lee Bieber wrote: On Tue, 25 Oct 2016 11:02:31 +0100, BartC declaimed the following: This gives you the ability to do (2) above. From that, you could do (1) (echoing) and go on to build full line-orientated input. But you had complete control. So, why has it all be

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread John Pote
If you are on a windows platform you could use kbhit() from the msvcrt module as Steven D does in his solution on the activestate site which also works for xNIX. Worth a look at his code to see how these sort of things are done on xNIX. Alternatively you could use a couple of threads. One for

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread BartC
On 25/10/2016 07:39, Steven D'Aprano wrote: I gather that non-blocking keyboard input functions aren't the easiest thing to implement. They seem to depend on the operating system. Still, ease of use is a primary goal of Python, and the need for this feature must be common. Not really. I thi