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 trialMat Clark
Python Development Techdegree Student 4,369 PointsPossible bug?
I keep getting a "Bummer: You should have a dunder main statement at the end of your file." message. I passed step 2, which was to add the dunder main statement. But now when I add the route and index function, it tells me this. I don't think I have anything wrong here. Can anybody spot a mistake?
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello Flask'
if __name__ == '__main__':
app.run(port=8000, host='0.0.0.0')
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Mat Clark! The only thing I can see that isn't quite right has to do with PEP 8 standards that say that there should be two blank lines after a function definition. So if I add an extra blank line between the return 'Hello Flask'
and the "dunder main", the challenge passes.
I'll reach out to the education team to see if this was intended.
Hope this helps!
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsThe challenge does state to follow PEP008 standards. The regex errors from the challenge checker indicate they are looking for double blank lines following the
import
, following theapp
statement, and before theif __name__
statement.