Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

Yosef Fastow
Yosef Fastow
18,526 Points

What is this Tab Error about?

I'm getting a Tab Error that I don't understand... Tab Error: inconsistent use of tabs and spaces in indentation

Why am I getting this Error and how do I prevent it?

1 Answer

Hi Yosef,

The error you're describing is caused by including both a tab and spaces to indent code in the same file. Python doesn't know how many spaces are intended by a tab for your code specifically, so it throws the error instead of guessing and potentially having unexpected results when the code is run. This error can be avoided by using an IDE which converts tabs to spaces, only using tabs for indentation, or only using spaces for indentation.

Hope that helps!