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 trialNoor Hafiza Binti Ibrahim
11,712 PointsWhy? I canโt pass the challenge. I keep getting Bummer: You should have a dunder main at the end of your file.
A dunder main at the end of file?
# insert your code here
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello Flask'
if __name__ == '__main__':
app.run(host='0.0.0.0', port='8000')
2 Answers
Chris Freeman
Treehouse Moderator 68,457 PointsHey Noor Hafiza Binti Ibrahim, your code is functionally correct.
However, the very picky checker is looking for two blank lines between the function definition and the dunder name statement.
Post back if you need more help. Good luck!!!
Drew Caruso
213 PointsIs it just me or is this really bad design? if nothing is wrong with the code and it wants x lines after line of code, it should say, right?
Chris Freeman
Treehouse Moderator 68,457 PointsPerhaps. I believe the checker uses regex to check correctness. It would be quite a task to have a regex for every failing case. Sometimes the cases overlap and an error is caught be a more general regex. The first failing regex causes the failure so it might not have the specific info youโre looking for. In the โTest Resultsโ panel, it shows which regex failed. This is how I debug failing student code.
Noor Hafiza Binti Ibrahim
11,712 PointsNoor Hafiza Binti Ibrahim
11,712 PointsThank you for the tips ๐, Chris Iโve fixed the two blank lines between the function definition and the dunder name statement, but, the challenge still didnโt pass. Instead, i got a: Bummer: Make sure to place your route after your app variable. So, yup iโm still stuck ๐ฅบ
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsFor Task 3 the checker wants 2 blank lines above the function as well.
Noor Hafiza Binti Ibrahim
11,712 PointsNoor Hafiza Binti Ibrahim
11,712 PointsIt passed! Yay ๐ Thank you very much.