Python: How to quit CLI when stuck in blocking raw_input?
Posted
by
christianschluchter
on Stack Overflow
See other posts from Stack Overflow
or by christianschluchter
Published on 2011-01-04T08:55:01Z
Indexed on
2011/01/04
12:53 UTC
Read the original article
Hit count: 163
I have a GUI program which should also be controllable via CLI (for monitoring). The CLI is implemented in a while loop using raw_input. If I quit the program via a GUI close button, it hangs in raw_input and does not quit until it gets an input.
How can I immediately abort raw_input without entering an input?
I run it on WinXP but I want it to be platform independent, it should also work within Eclipse since it is a developer tool. Python version is 2.6.
I searched stackoverflow for hours and I know there are many answers to that topic, but is there really no platform independent solution to have a non-blocking CLI reader?
If not, what would be the best way to overcome this problem?
Thanks
© Stack Overflow or respective owner