Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndentationError: unindent does not match any outer indentation level #358

Open
lispercat opened this issue Jan 15, 2023 · 3 comments
Open
Labels

Comments

@lispercat
Copy link

lispercat commented Jan 15, 2023

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
Copy link
Author

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.

@jpalardy
Copy link
Owner

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.

@stale
Copy link

stale bot commented May 21, 2023

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 stale bot added the wontfix label May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants