-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reloader doesn't add ".exe" to file on Windows #1614
Comments
Same issue using Flask 1.1.1/Werkzeug 0.15.5 on Windows 10, python 2.7.16, in a virtual environment. Looks like this: pallets/flask#1829 but it was fixed a long time ago. |
Noticed this with the release of 0.15.5 as well with an application factory pattern, executing from Windows 10, Python 3.6.2, Flask 1.0.3, via Powershell. Created an example repo here. The change seems to be caused by the function in 0.15.4 in 0.15.5 |
I can't reproduce this. I have Flask 1.1.1 and Werkzeug 0.15.5, and tried |
I tried this again on another Windows 10 machine with a system install of Python 2.7.15 (32-bit) and Python 3.7.2 (32-bit). The following steps (in powershell) reproduce the behavior for me. FLASK_ENV=production works fine, FLASK_ENV=development causes the error.
The contents of hello.py are from the flask tutorial: from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!' |
I've been discussing this on Discord too, and no matter what I try, everything works for me. I'm doing the same thing everyone else is to set up an env and run it. I'm going to have a hard time fixing this if I can't observe the behavior to debug it. Someone who has the issue is going to need to debug |
If someone can do |
here's the argv / executable for that:
if I use
|
oops pressed enter too quickly, I have more info to post |
It's expected that |
reverting e686ae7 fixes the issue here's where things appear to go wrong:
|
that doesn't solve the full mystery though -- why are you unable to reproduce this? I have a hunch, or at least, I've found a way to not reproduce it: $ pip install flask --no-binary :all: # previously I uninstalled flask
Collecting flask
Downloading https://files.pythonhosted.org/packages/2e/80/3726a729de758513fd3dbc64e93098eb009c49305a97c6751de55b20b694/Flask-1.1.1.tar.gz (625kB)
Requirement already satisfied: Werkzeug>=0.15 in c:\users\anthony\appdata\local\temp\x\werkzeug\src (from flask) (1.0.0.dev0)
Requirement already satisfied: Jinja2>=2.10.1 in c:\users\anthony\appdata\local\temp\x\venv\lib\site-packages (from flask) (2.10.1)
Requirement already satisfied: itsdangerous>=0.24 in c:\users\anthony\appdata\local\temp\x\venv\lib\site-packages (from flask) (1.1.0)
Requirement already satisfied: click>=5.1 in c:\users\anthony\appdata\local\temp\x\venv\lib\site-packages (fromflask) (7.0)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\anthony\appdata\local\temp\x\venv\lib\site-packages(from Jinja2>=2.10.1->flask) (1.1.1)
Installing collected packages: flask
Running setup.py install for flask: started
Running setup.py install for flask: finished with status 'done'
Successfully installed flask-1.1.1
(venv)
Anthony@AnthonysDesktop MINGW64 /tmp/x/werkzeug (master)
$ FLASK_ENV=development flask run
* Environment: development
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 158-953-008
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) |
Same issue here, on windows 10 Python 3.7.4, Flask 1.1.1/werkzeug 0.15.4 Git bisect shows e686ae7 is the first bad commit. On line 106: if os.path.isfile(py_script):
# Rewritten by Python from "-m script" to "/path/to/script.py". This condition bypasses on windows as the script path is without |
Ah, I was installing Flask by doing It's strange that the Windows installed entry point makes it look like a I can't just revert that commit, because it fixes another problem. It seems like we need to figure out some better heuristics for the different run cases. |
Hello, I've had a similar issue where I launch a Flask application from an exe in the Scripts folder of the python environment (built using the console_scripts in setuptools). Basically the reloader thinks this is a regular python package and not an exe because the The workaround to get my application working was to force Let me know if I'm missing something or if I'm off base in what I just described. |
How do we remove werkzeug library from flask? Flask is tagged v1 and we can't even run hello world with it without fatal error |
you can't and you don't. why would you want to do that? flask requires werkzeug. Use the latest werkzeug release together with the latest flask release. |
@samayo while we're at it, let's remove python from flask too. More serious: the workaround is |
If anyone wants to look at this, I'd be very happy. I haven't had much free time lately. |
@davidism Working on it, it turned out to be an easy fix after some research. |
#1627 does work, but goes down the wrong code path when running an |
I added some debug statements to Show debug output
Ultimately, this is probably a bug with setuptools, since the entry point it creates on Windows behaves differently for editable vs dist installs. |
Closed in #1627 |
if I run a flask app under 0.15.5 with
FLASK_ENV=development
the dev server throws an error.
With FLASK_ENV=production the server starts ok
After reinstalling 0.15.4 the same app works ok (both in dev and prod mode).
Windows/py3.6.7/pipenv
Kind regards
The text was updated successfully, but these errors were encountered: