I am trying to use the python module flask, and I have successfully installed it with pip. I can run the following in the command prompt python terminal and in the python shell:
from flask import Flask
It works just fine. However, when I try to run that exact same command in a saved python document, I get the following error:
Traceback (most recent call last):
File "C:\Users\Matthew\Desktop\flask.py", line 1, in <module>
from flask import Flask
File "C:\Users\Matthew\Desktop\flask.py", line 1, in <module>
from flask import Flask
ImportError: cannot import name 'Flask'
I have browsed the internet and stack exchange looking for a solution, but non have worked.
Rename the filename flask.py to other name; It prevents import of the third-party flask module because your file is searched first.
Also make sure there's no flask.pyc file remaining.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With