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
Nils Garland
18,416 PointsPython console errors, please help..
Hello, I am taking the Python flask social network course. I have have followed all the
instructions but it seems I am getting an error on line "33". Here is the error:
@app.after_request
^
IndentationError: unindent does not match any outer indentation level
I would love an answer asap, Thanks TC ( :
1 Answer
Chris Freeman
Treehouse Moderator 68,468 PointsA block of code is marked by a common indentation. The end the block is marked by the first line of code that is indented less.
This less indented line must align with one of the previous indented blocks, or the left margin.
You will need to post your all of your code for a specific answer this indention error.
Nils Garland
18,416 PointsNils Garland
18,416 PointsI don't really know if you can see all of it since I don't know how to show the hole thing as a block of code
[MOD: added ```python formatting -cf]
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsAfter reformatting code, the methods after_request and index have indention issues.
Are you mixing tabs and spaces? This can cause code to look aligned in some editors but fail syntax checking.
Use 4-space indentation. Some editors let you specify the default action when a TAB is pressed to be a 4-space indent.
Nils Garland
18,416 PointsNils Garland
18,416 PointsThanks, it helped. Found like hundreds of these errors after this. Trying to figure out how to solve them all. And if you have the time is "unexpected indent" and "expected indent block" the same? Thanks for helping out!
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 Points> And if you have the time is "unexpected indent" and "expected indent block" the same?
unexpected indent" is "saw an indent when it wasn't expected", andexpected indent block" is "didn't see an indentation when one was expected". This commonly happens when not indenting the line following a line ending in a colon.