__name__ not defined?

Isn’t __name__ a built-in Python variable that always is defined?

If I’m mistaken, hjow to define it?


1 Like

In line 6, to create the app variable, you use this code: app = Flask(__name). You need to replace __name with __name__.

This error is not related to __name__ == "__main__".


Yeah, __name__ is a built-in Python variable. However, as @KAlexK stated, you’re defining __name, not __name__, which is where the root of your problem lies.