Home > Software design >  Constantly getting TabError: inconsistent use of tabs and spaces in indentation
Constantly getting TabError: inconsistent use of tabs and spaces in indentation

Time:11-15

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

CodePudding user response:

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!
  • Related