How to timeout when waiting for raw_input from user ?
shearichard at gmail.com
Sat Dec 5 11:04:13 CET 2009
On Dec 5, 6:23 pm, Paul Rubin <no.em... at nospam.invalid> wrote:
> northof40 <shearich... at gmail.com> writes:
> > I'm thinking of some logic where a raw_input call is executed and then
> > if more than X seconds elapses before the prompt is replied to the
> > process writes a message "Sorry too slow" (or similar).
> The simplest way to do this is with the alarm function and a signal
> handler. See the docs for the signal module.
Hi Paul - Thanks for your reply. Unfortunately it seems like the bit
of the signal module I would need for this is not implemented for
windows (AttributeError: 'module' object has no attribute 'SIGALRM').
Still no matter when I asked the question I couldn't even figure out
what module might provide this functionality for any platform so it
was useful knowledge for the future. Thanks again.
More information about the Python-list