For starters, I'm on python 2.7.5 and Windows x64, my application targets these options.
I need a way to cancel raw_input after a while. Currently, I have a main thread starting two child threads, one a timer (threading.Timer) and the other starts raw_input. They return a value in Queue.queue, which tracks the main thread. Then it acts on what is sent to the queue.
q = Queue.queue()
user = threading.Thread(target=user_input, args=[q])
timer = threading.Timer(1200, q.put, ['y'])
while q.empty():
time.sleep(1)
timer.cancel()
i = q.get()
if i in 'yY':
elif i in 'nN':
def user_input(q):
i = raw_input(
"Unable to connect in last {} tries, "
"do you wish to continue trying to "
"reconnect? (y/n)".format(connect_retries))
q.put(i)
, , , , "" . , , , . , , , stdin .
, stdin , ?
!