Windows - select.select, timeout and KeyboardInterrupt
Paul Moore
p.f.moore at gmail.com
Thu May 6 11:59:21 EDT 2010
>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 raising
KeyboardInterrupt.
Is this a known limitation on Windows? I see no mention of it in the
documentation. Assuming it is a known limitation, is there a way round
it? (I'm writing a tiny server using asyncore/asynchat, and the
delayed response to Ctrl-C is a mild nuisance. Solutions such as "use
twisted", while probably the sensible option in a wider context, don't
really apply here - I need something within the confines of the stdlib
if it's to be worth doing).
Thanks,
Paul
More information about the Python-list
mailing list