flask icon indicating copy to clipboard operation
flask copied to clipboard

Application did not run with `flask run` with FLASK_DEBUG=1(But can run by using command`python -m flask run`) in Win10

Open shane-yao opened this issue 10 years ago • 8 comments

Error message: d:\projects\cfblog2_env\scripts\python.exe: can't open file 'D:\projects\cfblog2_env\Scripts\flask': [Errno 2] No such file or directory

Environment: Win 10, Py 3.5.2(VirtualEnv),Flask 0.11 This error was came from '_reload.py' in werkzeug.It seems like when run with flask.exe, sys.executable still equal to python's exe path and sys.argv is something like this:'D:\\projects\\cfblog2_env\\Scripts\\flask', 'run'

I am not sure what cause this problem actually(werkzeug,packer of flask.exe or flask itself).But this error happend when I using flask. So I put the issuse here.

To whom has the same error, you can usepython -m flask run for workaround. And last, sorry for my poor english.

shane-yao avatar Nov 13 '16 17:11 shane-yao

did you set FLASK_APP=</path/to/file/containing/app/instance>.py?

wgwz avatar Nov 13 '16 18:11 wgwz

It seems it can't find flask; which leads me to believe you either have not installed flask or you haven't activated your virtual environment.

To activate your virtual environment:

$ virtualenv env
$ source env/bin/activate

To install flask:

$ pip install flask

Hardly a bug.

Edit: misread, disregard my answer. It indeed looks like a bug figuring out flask's path.

saalaa avatar Nov 13 '16 18:11 saalaa

@future0906 does it work when not using debug mode?

untitaker avatar Nov 13 '16 21:11 untitaker

@untitaker Yes, both ways(python -m flask run or flask run) work when not using FLASK_DEBUG=1. @wgwz @saalaa Sure I did.And as I said before, this didn't work only when I use flask run and set the debug flag 1.

shane-yao avatar Nov 14 '16 01:11 shane-yao

@future0906 Create a copy of flask.exe and rename it "flask" without the extension. This is a temporary fix.

radianrad avatar Nov 30 '16 04:11 radianrad

@untitaker Is this issue similar to #1829?

ferbecab03 avatar Dec 09 '16 17:12 ferbecab03

Yes, appears to be a dupe

untitaker avatar Dec 09 '16 18:12 untitaker

Error message: d:\projects\cfblog2_env\scripts\python.exe: can't open file 'D:\projects\cfblog2_env\Scripts\flask': [Errno 2] No such file or directory

Environment: Win 10, Py 3.5.2(VirtualEnv),Flask 0.11 This error was came from '_reload.py' in werkzeug.It seems like when run with flask.exe, sys.executable still equal to python's exe path and sys.argv is something like this:'D:\\projects\\cfblog2_env\\Scripts\\flask', 'run'

I am not sure what cause this problem actually(werkzeug,packer of flask.exe or flask itself).But this error happend when I using flask. So I put the issuse here.

To whom has the same error, you can usepython -m flask run for workaround. And last, sorry for my poor english.

THANK YOU!!!! I've been trying to get this to work for almost a week, no one could help. Also, your English is great!

elizaench16 avatar May 19 '20 16:05 elizaench16