Python Flask Basics Character Builder Items

Dean McKenzie
Dean McKenzie
11,148 Points

Console 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
MOD
Chris Freeman
Treehouse Moderator 59,891 Points

Taylor, 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
Josh Keenan
19,311 Points

Simple enough I think, try this.

from flask import Flask, redirect, render_template
Dean McKenzie
Dean McKenzie
11,148 Points

Hi 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
Chris Freeman
Treehouse Moderator 59,891 Points

Taylor, 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
Josh Keenan
19,311 Points

I get it Chris, on any flask project in my workspaces that have no problems..

Chris Freeman
Chris Freeman
Treehouse Moderator 59,891 Points

Right. 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
Josh Keenan
19,311 Points

Okay, will have a look at it myself

Josh Keenan
Josh Keenan
19,311 Points

Can you post all your code as well

Josh Keenan
Josh Keenan
19,311 Points

Okay 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
Dean McKenzie
11,148 Points

Not 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
Dean McKenzie
11,148 Points

Thanks 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.

Dean McKenzie
Dean McKenzie
11,148 Points

Thanks Chris I can confirm that my program is now running.