def interact(self):
while 1:
try: # catches EOFError's and KeyboardInterrupts during execution
try: # catches KeyboardInterrupts during editing
try: # warning saver
# can't have warnings spewed onto terminal
sv = warnings.showwarning
warnings.showwarning = eat_it
l = unicode(self.reader.readline(), 'utf-8')
finally:
warnings.showwarning = sv
except KeyboardInterrupt:
print("KeyboardInterrupt")
else:
if l:
self.execute(l)
except EOFError:
break
except KeyboardInterrupt:
continue
评论列表
文章目录