Canceling/interrupting raw_input

J. W. McCall jmccall at houston.rr.com
Mon Apr 18 00:31:58 EDT 2005


I'm working on a MUD server and I have a thread that gets keyboard input 
so that you can enter commands from the command line while it's in its 
main server loop.  Everything works fine except that if a player enters 
the 'shutdown' command, everything shuts down, but the input thread is 
still sitting waiting for enter to be pressed for raw_input.  After 
enter is pressed, it exits back to the command prompt as it should.

I'm wondering if there's a way that I can make the thread stop waiting 
for input.  Even sys.exit() still leaves it waiting.  It's not a big 
deal, but it bugs me.

Any ideas?  Should I be using something other than raw_input?  I'm on 
Windows2000 and running this from the DOS prompt.  I'm using Python 2.4.



More information about the Python-list mailing list