##// END OF EJS Templates
Only tell the user about %paste in the terminal shell.
Thomas Kluyver -
Show More
@@ -1605,6 +1605,10 b' class InteractiveShell(SingletonConfigurable, Magic):'
1605 value = msg, (filename, lineno, offset, line)
1605 value = msg, (filename, lineno, offset, line)
1606 stb = self.SyntaxTB.structured_traceback(etype, value, [])
1606 stb = self.SyntaxTB.structured_traceback(etype, value, [])
1607 self._showtraceback(etype, value, stb)
1607 self._showtraceback(etype, value, stb)
1608
1609 # This is overridden in TerminalInteractiveShell to show a message about
1610 # the %paste magic.
1611 showindentationerror = showsyntaxerror
1608
1612
1609 #-------------------------------------------------------------------------
1613 #-------------------------------------------------------------------------
1610 # Things related to readline
1614 # Things related to readline
@@ -2274,8 +2278,7 b' class InteractiveShell(SingletonConfigurable, Magic):'
2274 try:
2278 try:
2275 code_ast = ast.parse(cell, filename=cell_name)
2279 code_ast = ast.parse(cell, filename=cell_name)
2276 except IndentationError:
2280 except IndentationError:
2277 self.showsyntaxerror()
2281 self.showindentationerror()
2278 print("If you want to paste code into IPython, try the %paste magic function.")
2279 self.execution_count += 1
2282 self.execution_count += 1
2280 return None
2283 return None
2281 except (OverflowError, SyntaxError, ValueError, TypeError,
2284 except (OverflowError, SyntaxError, ValueError, TypeError,
@@ -588,6 +588,10 b' class TerminalInteractiveShell(InteractiveShell):'
588 write("## -- End pasted text --\n")
588 write("## -- End pasted text --\n")
589
589
590 self._execute_block(block, par)
590 self._execute_block(block, par)
591
592 def showindentationerror(self):
593 super(TerminalInteractiveShell, self).showindentationerror()
594 print("If you want to paste code into IPython, try the %paste magic function.")
591
595
592
596
593 InteractiveShellABC.register(TerminalInteractiveShell)
597 InteractiveShellABC.register(TerminalInteractiveShell)
General Comments 0
You need to be logged in to leave comments. Login now