inconsistent use of tabs and spaces

Seems like I get this error when everything is fine. Sometimes I go to add something under a if statement and it seems like everything is lined up fine. Why does this do this. Sometimes it fixes it sel wierdly. Sometimes i have to delete the whole IF black and start over. What does this mean

This is a section of my script

The script on the left runs fine. Add a Print statement on the right…Inconsistent use of tabs and spaces…I dont understand


Re-check brackets, and post the full script ,not screenshots.

A lots of weird things like this one happens to me too (but there are no error). I wonder why.

Anyway, you can try
Format/Convert Whitespace/To spaces

This problem comes up when you mix tabs and spaces. For example two lines can be lined up visually, but one has 4 spaces in front of it, while the other has 1 tab.

This problem comes up a lot because the python style guide (pep8) recommends the use of spaces, but a lot of people prefer to use tabs. This leads to situations such as editing someone’s code that uses spaces, but your editor is inserting tabs for you for auto-alignment.

Thanks guys I figures a workaround for mine. I was basically just wondering if this was something commom. It happens quite often in various scripts i write. I never use tab though, Only spaces. I think if you have spaces before you press ENTER for a new line it can affect it AS well. I rewrote count spaces and it cleaned up. Thanks for the help

If you press <CR> after a “:” Blender indents the next line. It uses the current indentation filler + whatever Blender prefers as indentation.

This work pretty well as long as you continue to add new lines by <CR> from a previous filled line.

It breaks if you do indentation manually and use another filler.

TAB is very useful, it found ever the right column ,(so you avoid to count 1-2-3-4 spaces to found the column)
try to check “tab as spaces” then , select many line and press TAB , and SHIFT+TAB , you see what can make
after, you cannot more write without TAB!(as spaces!)