##// END OF EJS Templates
One more KeyboardInterrupt catch
vivainio -
Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2916 2007-12-31 13:14:43Z vivainio $
9 $Id: iplib.py 2919 2007-12-31 14:45:55Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -1504,32 +1504,35 b' want to merge them back into the new files.""" % locals()'
1504 # Though this won't be called by syntax errors in the input line,
1504 # Though this won't be called by syntax errors in the input line,
1505 # there may be SyntaxError cases whith imported code.
1505 # there may be SyntaxError cases whith imported code.
1506
1506
1507
1507 try:
1508 if exc_tuple is None:
1508 if exc_tuple is None:
1509 etype, value, tb = sys.exc_info()
1509 etype, value, tb = sys.exc_info()
1510 else:
1511 etype, value, tb = exc_tuple
1512
1513 if etype is SyntaxError:
1514 self.showsyntaxerror(filename)
1515 elif etype is IPython.ipapi.UsageError:
1516 print "UsageError:", value
1517 else:
1518 # WARNING: these variables are somewhat deprecated and not
1519 # necessarily safe to use in a threaded environment, but tools
1520 # like pdb depend on their existence, so let's set them. If we
1521 # find problems in the field, we'll need to revisit their use.
1522 sys.last_type = etype
1523 sys.last_value = value
1524 sys.last_traceback = tb
1525
1526 if etype in self.custom_exceptions:
1527 self.CustomTB(etype,value,tb)
1528 else:
1510 else:
1529 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1511 etype, value, tb = exc_tuple
1530 if self.InteractiveTB.call_pdb and self.has_readline:
1512
1531 # pdb mucks up readline, fix it back
1513 if etype is SyntaxError:
1532 self.set_completer()
1514 self.showsyntaxerror(filename)
1515 elif etype is IPython.ipapi.UsageError:
1516 print "UsageError:", value
1517 else:
1518 # WARNING: these variables are somewhat deprecated and not
1519 # necessarily safe to use in a threaded environment, but tools
1520 # like pdb depend on their existence, so let's set them. If we
1521 # find problems in the field, we'll need to revisit their use.
1522 sys.last_type = etype
1523 sys.last_value = value
1524 sys.last_traceback = tb
1525
1526 if etype in self.custom_exceptions:
1527 self.CustomTB(etype,value,tb)
1528 else:
1529 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1530 if self.InteractiveTB.call_pdb and self.has_readline:
1531 # pdb mucks up readline, fix it back
1532 self.set_completer()
1533 except KeyboardInterrupt:
1534 self.write("\nKeyboardInterrupt\n")
1535
1533
1536
1534
1537
1535 def mainloop(self,banner=None):
1538 def mainloop(self,banner=None):
General Comments 0
You need to be logged in to leave comments. Login now