Ask coding questions

← Back to all posts
ImportError: cannot import name 'Flask' from 'flask' (unknown location)
myxi (0)

This is my import statement:
from flask import Flask, render_template, redirect, url_for, request
whats wrong?????

Fixed

  • uninstalled flask by pip uninstall flask
  • then i removed flask from packages
  • uninstalled werkzeug using pip
  • installed it again using pip
Voters
myxi (0)
Comments
hotnewtop
InvisibleOne (2986)

I'm only getting an error from line twenty eight, because you are using an await outside of an async function.

OldWizard209 (1531)

Change it to: from flask import *

myxi (0)

@OldWizard209

  File "main.py", line 8, in <module>
    app = Flask(__name__)
NameError: name 'Flask' is not defined
```