vim-slime icon indicating copy to clipboard operation
vim-slime copied to clipboard

IndentationError: unindent does not match any outer indentation level

Open lispercat opened this issue 3 years ago • 3 comments

I am having this issue in neovim v0.8.1 using neovim terminal using jupyter-console (Jupyter console 6.4.4, IPython 8.8.0 with Python 3.11.1).

The function is:

def test(arr):
    result = 0
    for i in range(6):
        for j in range(6):
            print(arr[i][j])
    return result

The error is:

In [121]:         for j in range(6):                                                            
     ...:                 print(arr[i][j])                                                        
     ...:             return result
  File <tokenize>:3
    return result
    ^
_IndentationError: unindent does not match any outer indentation level_

What I tried: If I just copy/paste the text to the console, it works.

Enabling let g:slime_python_ipython = 1 doesn't work because jupyter-console responds: "UsageError: Line magic function %cpaste not found"

Same as trying to toggle %autoindent resluts in: UsageError: Line magic function %autoindent not found.

lispercat avatar Jan 15 '23 18:01 lispercat

Looks like it may have to do with the neovim terminal. I installed a newer neovim v0.8.2 and it doesn't give me that error, but it correctly sends the text to the buffer without adding the final "Enter". So to fully evaluate the function I need to switch to the terminal and press the Return button to get input evaluated.

lispercat avatar Jan 15 '23 20:01 lispercat

hi @lispercat

The tmux bracketed_paste mode has a workaround for a similar situation.

I'm neither a neovim, nor a ipython user … if you think this is the right way, send me a PR

You can git blame and cc the relevant users for help too.

jpalardy avatar Jan 15 '23 23:01 jpalardy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 21 '23 20:05 stale[bot]