4 Spaces For Indentation - Syntax Error
Solution 1:
If you're getting Syntax Error because of indentations it is most probably related to the fact that your code includes both TABS and SPACES as methods of indentation. Even though the code might appear to be be indented the same amount from the left, a TAB is a single symbol, whereas the same indentation using SPACEs takes 4 (in your case) symbols. Python freaks out and throws an error, because it doesn't see the rendering of code you see, it sees an inconsistent number of symbols used before the line.
To fix this, firstly substitute all tabs with the appropriate equivalent of spaces, and then go through your code and make sure that all the indentation in your code is valid and correct. If you're using an editor like Sublime Text then you can do this with one or two clicks, with a more primitive editor finding the TAB/SPACE difference might be much more tedious.
Hope this helps
Solution 2:
Throwing an exception: pass solves it. It is not needed when using indentation from a Text editor. That's weird.
Post a Comment for "4 Spaces For Indentation - Syntax Error"