How to timeout when waiting for raw_input from user ?

Maxim Khitrov mkhitrov at gmail.com
Sat Dec 5 09:42:07 EST 2009


On Sat, Dec 5, 2009 at 9:11 AM, Rune Strand <rune.strand at gmail.com> wrote:
> On Dec 5, 3:07 pm, Maxim Khitrov <mkhit... at gmail.com> wrote:
>>
>> Doesn't work on Windows.
>>
>> - Max
>
> Yes, it does. I've used it a lot, also in Py2Exe apps.  Try the
> documentation example yourself
>
> def hello():
>    print "hello, world"
>
> t = Timer(30.0, hello)
> t.start() # after 30 seconds, "hello, world" will be printed

I'm not talking about the Timer, I'm talking about the original
question. There's nothing (that I know of) you can do with a Timer on
Windows to interrupt a raw_input call.

- Max



More information about the Python-list mailing list