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 trialDean McKenzie
11,149 PointsConsole for this task does not seem to be working. Keep getting an import error for flask.
Whilst doing the flask video I am unable to run my program due to an import error. Now this did work yesterday however it is not working today, could somebody from the Treehouse team please advise?
treehouse:~/workspace$ python app.py
Traceback (most recent call last):
File "app.py", line 2, in <module>
from flask import (flask, render_template, redirect,
ImportError: No module named flask
Kind Regards
7 Answers
Chris Freeman
Treehouse Moderator 68,457 PointsTaylor, it seems the PATH environment is not correct on Workspaces. python
is pointing at python2
not python3
.
The short-term workaround is to use python3 app.py
Josh Keenan
20,315 PointsSimple enough I think, try this.
from flask import Flask, redirect, render_template
Dean McKenzie
11,149 PointsHi Josh tried changing the Flask from lower case to upper case and it has not made a difference. Thanks for your prompt help though.
Chris Freeman
Treehouse Moderator 68,457 PointsTaylor, are you saying you are still getting the exact same error "ImportError: No module named flask
" (note lowercase f) after you change your import statement to use upper-cased Flask?
Josh Keenan
20,315 PointsI get it Chris, on any flask project in my workspaces that have no problems..
Chris Freeman
Treehouse Moderator 68,457 PointsRight. It's complaining about the from flask
module missing not the import f/Flask
attribute. If it were due to import f/Flask
you would have seen a different error:
ImportError: cannot import name....
Josh Keenan
20,315 PointsOkay, will have a look at it myself
Josh Keenan
20,315 PointsCan you post all your code as well
Josh Keenan
20,315 PointsOkay my flask projects that I haven't worked on in a while won't run either.. :S
Presuming they are updating something or other!
Dean McKenzie
11,149 PointsNot sure if the full code will help in this circumstance as it seems to be a direct Flask import problem. I think your right they maybe doing some sort of upgrade , or have some of outage.
Again thanks for taking the time to look into and answer my question.
Enjoy your evening.
Dean McKenzie
11,149 PointsThanks Chris that works, who do I speak to in order to get this permanently rectified as I would like to complete this course within the next couple of days.
Thanks Again for you support.
Chris Freeman
Treehouse Moderator 68,457 PointsIt should be fixed sometime today.
Dean McKenzie
11,149 PointsThanks Chris.
Chris Freeman
Treehouse Moderator 68,457 PointsI've been told it's fixed!
Dean McKenzie
11,149 PointsThanks Chris I can confirm that my program is now running.