0

i have this error after run:

Traceback (most recent call last):
  File "/home/user/PycharmProjects/third_project/flask_test.py", line 1, in <module>
    from flask import Flask
  File "/home/user/PycharmProjects/third_project/flask.py", line 1, in <module>
    from flask import Fl
ImportError: cannot import name 'Fl' from partially initialized module 'flask' (most likely due to a circular import) (/home/user/PycharmProjects/third_project/flask.py)

Process finished with exit code 1

************************ the code :flask_test.py**************************

from flask import Flask

skills_app = Flask(__name__)

@skills_app.route("/")
def hompage():
    return "hello flask"

@skills_app.route("/about")
def about():
    return "hello flask/about"

if __name__=="__main__":
    skills_app.run(debug=True)
Jürgen Gmach
  • 5,366
  • 3
  • 20
  • 37
Aissa
  • 1
  • 1
  • 2
  • 5
    You named your program `flask,py`, so that's what's being found by `import flask` instead of the actual Flask module. – jasonharper Jul 17 '20 at 13:26
  • thnx bro but i changed the name and installed the package as it needs but same error – Aissa Jul 17 '20 at 13:28
  • 1
    You may need to delete any `flask.pyc` or similar files that were generated from the incorrect import. – jasonharper Jul 17 '20 at 13:29
  • ooh thnx finally yes it is done as u said by the pyc file thank you – Aissa Jul 17 '20 at 13:41
  • 1
    Does this answer your question? [Importing installed package from script raises "AttributeError: module has no attribute" or "ImportError: cannot import name"](https://stackoverflow.com/questions/36250353/importing-installed-package-from-script-raises-attributeerror-module-has-no-at) – pppery Jul 17 '20 at 18:12
  • Why are you importing `Fl` from the flask module? What's `Fl`? – Ken Kinder Jul 17 '20 at 19:44
  • thnk u all i had much help in your commnts – Aissa Jul 25 '20 at 18:10

0 Answers0