Page 1 of 1

Flask(_name_) error please

Posted: Sun Oct 05, 2014 5:16 pm
by benyrey
Hello world,

I installed flask ([email protected] ~ $ sudo pip install flask) but then I get
the following error:
app = Flask(_name_)
NameError: name '_name_' is not define
As usually I do not know what the heck to do.

Thanks a lot

Beny

Re: Flask(_name_) error please

Posted: Sun Oct 05, 2014 5:37 pm
by DirkS
I think there should be 2 underscores before and after 'name':

Code: Select all

app = Flask(__name__)
Gr.
Dirk.

Re: Flask(_name_) error please

Posted: Sun Oct 05, 2014 6:02 pm
by benyrey
Thanks DirkS,

You're right: two underscore(s) before and after 'name'

I appreciate your support

Beny

Re: Flask(_name_) error please

Posted: Mon Mar 05, 2018 7:57 am
by kartik62
i am still getting this same error even after editing it with double underscores before and after name.
can anyone please tell what is the error here.
Capture2.PNG
Capture2.PNG (3.5 KiB) Viewed 2507 times
Capture1.PNG
Capture1.PNG (4.11 KiB) Viewed 2507 times

Re: Flask(_name_) error please

Posted: Tue Mar 06, 2018 5:03 pm
by squiregeek
I'm fairly new with Flask, but you might consider adding if ___name == "__main__": before app.run(). Has to do with decorators which I'm still learning about.

I've run a couple of simple scripts that way without problems. Hope this helps.

Re: Flask(_name_) error please

Posted: Tue Mar 06, 2018 9:29 pm
by elParaguayo
Your error message still shows single underscores before and after name.