user19912573
user19912573

Reputation:

Constantly getting TabError: inconsistent use of tabs and spaces in indentation

I'm getting these TabErrors constantly and it's really slowing down my work flow. I can't figure out how to make them go away. I get them to disappear by completely retyping my script, and then I add a new function and suddenly everything is messed up again. I have not changed the way I indent my code. I am not adding extra whitespace. I am not doing anything differently but suddenly I'm getting TabErrors all the time. I'm using vscode. Is there something I can use to properly format my code? I really need this problem to stop happening.

enter image description here

Upvotes: 1

Views: 1427

Answers (1)

JRiggles
JRiggles

Reputation: 6810

Add this to your settings.json file

"[python]": {
    "editor.insertSpaces": true, // if you want to use spaces, false for tabs
    "editor.tabSize": 4,
}  // you may need a trailing comma here - you've been warned!

Upvotes: 1

Related Questions