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 trialcassac
9,628 PointsCode passes unit tests but... "Bummer! Your code took too long to run."
My code passes all of the unit tests in 'app_tests.py'. I copy and paste the appropriate code into the different tabs of the tacocat challenge and when I hit submit I get the error "Bummer! Your code took too long to run."
Any ideas?
1 Answer
cassac
9,628 PointsTo answer my own question... When pasting the code for 'tacocat.py' into the challenge I removed the code block below and it passed.
if __name__ == '__main__':
models.initialize()
try:
models.User.create_user(
email='tacolover@taco.com',
password='password'
)
except ValueError:
pass
app.run(debug=DEBUG, host=HOST, port=PORT)
Greg Kaleka
39,021 PointsGreg Kaleka
39,021 PointsTo format your code, use Markdown (see the Markdown Cheatsheet link below the textarea when writing/editing a post). Here's how it works:
```Python
[All your code]
```
cassac
9,628 Pointscassac
9,628 PointsAhhh, I was using ' instead of `. Thanks
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherYeah, you have to take out the
app.run()
if you used it. You don't technically need it to pass the tests in the Workspace and, sadly, I can't strip it out myself before the validator runs. Glad you figured it out, though!EDIT: I added a note about removing the
app.run()
calls to the code challenge prompt. Thanks for reminding me!