[Python-Dev] KeyboardInterrupt not catch

Qi Yong qiyong at sosdg.org
Mon Nov 8 02:43:33 CET 2010


Hello,
With this script, after ctrl-d, ctrl-c exception not catch.
Is it a python bug or a wrong exception usage? Thanks.
If with import readline, this problem disappears.
-- qiyong
def parse():
 try:
 answer = raw_input("Eo: ")
 print answer
 except EOFError:
 print("EOF")
 except KeyboardInterrupt:
 print("")
def main():
 while True:
 parse()
if __name__ == "__main__":
 main()
-- 
Qi Yong


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /