Python Using Databases in Python Our Diary App Switching It Up

The Diary application shows Indentation error.

When I execute the application using ./ it shows me the following error. I tried even the original script downloaded from treehouse but it still gives me the same error.

nagabhushan@nagabhushan-Inspiron-1525:~$ ./

File "./", line 13 class Meta: ^

TabError: inconsistent use of tabs and spaces in indentation

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 59,892 Points

It is not always obvious what causes a "TabError: inconsistent use of tabs and spaces in indentation" because, depending on the display or code editor, the code may appear to be aligned, but actually has indention errors because a TAB is not always represented the with the same number of spaces everywhere.

The recommendation is to use only spaces (preferably 4-spaces!) for indenting and completely avoid TABs for this reason.

The error message tells you that the error is around line 13. Indentation errors are sometimes cause by the preceding line!

Otherwise, try searching your code for TABs and replace them with spaces. If you're able to load the code into a syntax-aware editor (emacs, vim, pycharm, sublime, etc.) or run a syntax checker such as pyflakes or pylint the error should be quickly obvious.