What is the “inconsistent use of tabs and spaces in indentation” error and why is it caused? and what is the solution

Knowingly or unknowingly you have used spaces instead of tabs, or the tabs are inconsistent in your python code. To solve this problem you should first make it apparent what is culprit and where is the culprit.

Sublime Text 3

Make all whitespace characters visible, in Sublime text you should edit Preferences > Settings > User Settings

In your User Settings file add this config. Also if this is the last line in the config don’t end with a comma.

    "draw_white_space": "all"

After applying the settings you can easily see it as shown below.

inconsistent use of tabs and spaces in indentation

VS Code 1.6.0 and Greater

As mentioned by aloisdg beloweditor.renderWhitespace is now an enum taking either noneboundary or all. To view all whitespaces:

"editor.renderWhitespace": "all", 

Before VS Code 1.6.0

Before 1.6.0, you had to set editor.renderWhitespace to true:

"editor.renderWhitespace": true

Vim editor

You can open the file and give ESC : set list

Except spaces, every other whitespace characters will be clearly visible as shown below.