Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-09 Thread Lawrence D'Oliveiro
In message mailman.2769.1273327083.23598.python-l...@python.org, exar...@twistedmatrix.com wrote: On 07:48 am, l...@geek-central.gen.new_zealand wrote: In message mailman.2760.1273288730.23598.python-l...@python.org, exar...@twistedmatrix.com wrote: This is a good example of why it's a bad

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-09 Thread Paul Kölle
Am 09.05.2010 11:59, schrieb Lawrence D'Oliveiro: In messagemailman.2769.1273327083.23598.python-l...@python.org, exar...@twistedmatrix.com wrote: On 07:48 am, l...@geek-central.gen.new_zealand wrote: In messagemailman.2760.1273288730.23598.python-l...@python.org, exar...@twistedmatrix.com

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Lawrence D'Oliveiro
In message mailman.2760.1273288730.23598.python-l...@python.org, exar...@twistedmatrix.com wrote: This is a good example of why it's a bad idea to use select on Windows. Instead, use WaitForMultipleObjects. How are you supposed to write portable code, then? --

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Giampaolo Rodolà
2010/5/7 Antoine Pitrou solip...@pitrou.net: Le Fri, 07 May 2010 21:55:15 +0200, Giampaolo Rodolà a écrit : Of course, but 30 seconds look a little bit too much to me, also because (I might be wrong here) I noticed that a smaller timeout seems to result in better performances. That's

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Antoine Pitrou
On Sat, 8 May 2010 13:47:53 +0200 Giampaolo Rodolà g.rod...@gmail.com wrote: Assuming loop() function does something like this: ... select.select(r, w, e, timeout) scheduler() # checks for scheduled calls to be fired ... ...imagine a case where there's a connection

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread exarkun
On 07:48 am, l...@geek-central.gen.new_zealand wrote: In message mailman.2760.1273288730.23598.python-l...@python.org, exar...@twistedmatrix.com wrote: This is a good example of why it's a bad idea to use select on Windows. Instead, use WaitForMultipleObjects. How are you supposed to write

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread exarkun
On 11:47 am, g.rod...@gmail.com wrote: 2010/5/7 Antoine Pitrou solip...@pitrou.net: Le Fri, 07 May 2010 21:55:15 +0200, Giampaolo Rodol� a �crit�: Of course, but 30 seconds look a little bit too much to me, also because (I might be wrong here) I noticed that a smaller timeout seems to result

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-08 Thread Giampaolo Rodolà
2010/5/8 Antoine Pitrou solip...@pitrou.net: On Sat, 8 May 2010 13:47:53 +0200 Giampaolo Rodolà g.rod...@gmail.com wrote: Assuming loop() function does something like this:      ...      select.select(r, w, e, timeout)      scheduler()  # checks for scheduled calls to be fired      ...

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-07 Thread Paul Moore
On 6 May, 20:58, Thomas Heller thel...@ctypes.org wrote: If you look at the source code for time.sleep(), which CAN be interrupted by pressing Ctrl-C, you will find that it is carefully programmed to be interruptible (sp?).  Which is not the case for select.select(), obviously. Thanks - given

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-07 Thread Giampaolo Rodolà
You can easily avoid this by setting a lower timeout when calling asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001 secs). Actually there's no reason for asyncore to have such a high default timeout (30 seconds). I think this should be signaled on the bug tracker. ---

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-07 Thread Antoine Pitrou
Le Fri, 07 May 2010 16:36:44 +0200, Giampaolo Rodolà a écrit : You can easily avoid this by setting a lower timeout when calling asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001 secs). Actually there's no reason for asyncore to have such a high default timeout (30

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-07 Thread Paul Moore
On 7 May 2010 15:36, Giampaolo Rodolà g.rod...@gmail.com wrote: You can easily avoid this by setting a lower timeout when calling asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001 secs). Thanks, that's what I was considering. Actually there's no reason for asyncore to

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-07 Thread Giampaolo Rodolà
2010/5/7 Antoine Pitrou solip...@pitrou.net: Le Fri, 07 May 2010 16:36:44 +0200, Giampaolo Rodolà a écrit : You can easily avoid this by setting a lower timeout when calling asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001 secs). Actually there's no reason for asyncore

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-07 Thread Antoine Pitrou
Le Fri, 07 May 2010 21:55:15 +0200, Giampaolo Rodolà a écrit : Of course, but 30 seconds look a little bit too much to me, also because (I might be wrong here) I noticed that a smaller timeout seems to result in better performances. That's probably bogus. Plus, if scheduled callbacks are

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-07 Thread exarkun
On 7 May, 07:25 pm, p.f.mo...@gmail.com wrote: On 7 May 2010 15:36, Giampaolo Rodol� g.rod...@gmail.com wrote: You can easily avoid this by setting a lower timeout when calling asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001 secs). Thanks, that's what I was

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-06 Thread Thomas Heller
Paul Moore schrieb: From a quick experiment, it seems that select.select with a timeout doesn't react to a keyboard interrupt until the timeout expires. Specifically, if I do s = socket.socket() select.select([s], [], [], 30) and then press Ctrl-C, Python waits for the 30 seconds before