Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Gabor Galantai
Courses Plus Student 17,247 Points"Forms with Validators" code challenge step 2 is drunk
I've had a problem here when at the 2nd step of the code challenge I received an error that said "Step 1 is no longer passing." Needless to say, this is a stupid, untrue, and utterly useless error message. Upon further investigation I've discovered that the problem was actually a "tab error" at the password = PasswordField line. And the reason for that error was that I used a TAB instead of 4 spaces. The indentation was exactly the same amount, but your program identified it as an error. And I've wasted 10-15 minutes on this.
2 Answers
Michael Hulet
47,913 PointsIn Python, it's illegal to mix tabs and spaces in a file, and will throw a TabError. It's not a problem with Treehouse (other than the fact that they're using spaces instead of tabs, which is a total preference thing). The proper solution here would be simply to use spaces instead of tabs, unless you really feel like going back and changing all of Treehouse's spaces to tabs
Example code from my shell:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def test():
... print("Spaces")
... print("Tab")
File "<stdin>", line 3
print("Tab")
^
TabError: inconsistent use of tabs and spaces in indentation
Gabor Galantai
Courses Plus Student 17,247 PointsGabor Galantai
Courses Plus Student 17,247 PointsI have always used tabs throughout my entire Python learning, and I've never received a TabError until now. But I'll keep it in mind and try to use spaces instead - at least in the code challenges. Thanks for your reply.
Michael Hulet
47,913 PointsMichael Hulet
47,913 PointsTo be clear, you can use either tabs or spaces in normal Python programming. Whichever you prefer. However, you just can't mix using tabs and spaces in the same file, and it seems that at least this particular challenge prefers spaces