Permalink
Browse files

Show message about %paste magic on an IndentationError from code in t…

…he prompt.
  • Loading branch information...
1 parent 8509782 commit 1848240bc4888173a86d73abaff4f78cb79a0e27 @takluyver committed Jul 13, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 IPython/core/interactiveshell.py
@@ -2273,6 +2273,11 @@ def run_cell(self, raw_cell, store_history=True):
with self.display_trap:
try:
code_ast = ast.parse(cell, filename=cell_name)
+ except IndentationError:
+ self.showsyntaxerror()
+ print("If you want to paste code into IPython, try the %paste magic function.")
+ self.execution_count += 1
+ return None
except (OverflowError, SyntaxError, ValueError, TypeError,
MemoryError):
self.showsyntaxerror()

0 comments on commit 1848240

Please sign in to comment.