0

When pasting in a large class (>800 lines), it seems like IPython can lose track of the indentations and then will return an IndentationError:

In [1]: %paste
  File "<tokenize>", line 772
    (self.D['Department']==dept) &
    ^
IndentationError: unindent does not match any outer indentation level

Might be a memory or terminal overflow issue, but wanted to post here for reference since one can spend hours trying to track down tabs that don't exist and turn them into spaces. When you google or SO for IndentationError, "replace tabs with spaces" is literally the only solution. This obviously won't work in this case.

This is not a duplicate, it's a similar error but a very different issue.

so860
  • 408
  • 3
  • 12

1 Answers1

0

The only solution I've come up with is to call the code block from the command line. The IPython compiler seems to have no issue, the problem is probably with the magic %paste buffer.

$ ipython code_block.py

so860
  • 408
  • 3
  • 12