0

In python code in vscode I am getting the following error

unindent does not match any outer indentation level (<unknown>, line 33)pylint(syntax-error)

This error was showing as a red mark at line return traversal

I noticed that there is a lack of space in the is statement and correcting it fixed the error. Now this is weird it didn't show the error mark at right place.

Also I think there must be some option in vscode to automatically fix such errors.

Any suggestions?

5
  • If VSC would fix this automatic it would automatically write my program, indentation determines the logic Commented Jan 30, 2021 at 11:24
  • Well intellij does automatically fixes lot of things in Java Commented Jan 30, 2021 at 11:38
  • Because you can write all your Java code on 1 line and still have a working program Commented Jan 30, 2021 at 12:23
  • The difference is that Java doesn't care about indentation, it is mostly to enable humans to understand easily if indented logically. Python requires indentation to determine logic, for example in an if statement, there are no closing curlies, the statement ends when the indentation does. VSCode cannot automatically indent because as said above, it would be writing your program for you! Commented Jan 30, 2021 at 13:20
  • Does this answer your question? Auto correct indentation errors in Python Commented Jan 30, 2021 at 16:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.