Skip to content
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

If arguments are re-written before flask is loaded it sees the original arguments on windows python 2.7 #3297

karthiknadig opened this issue Jul 10, 2019 · 2 comments


Copy link

@karthiknadig karthiknadig commented Jul 10, 2019

Previously flask (v1.0.3) was passing sys.argv to cli.main:

Now flask (v1.1.1) is not passing argv, to cli.main.

This causes it to always get args via get_os_args via click.

Which is this issue in click pallets/click#536

This basically breaks debugging (on windows with python 2.7), where the debugger re-writes sys.argv before click or flask is loaded. So, attempting to debug flask using ptvsd or pydevd results in the error message below.


>python -m ptvsd --host localhost --port 5692 -m flask run --no-debugger --no-reload --with-threads --port 5014
 * Serving Flask app "app"
 * Environment: development
 * Debug mode: on
 * Running on (Press CTRL+C to quit)


>python -m ptvsd --host localhost --port 5692 -m flask run --no-debugger --no-reload --with-threads --port 5014
Usage: python -m flask [OPTIONS] COMMAND [ARGS]...
Try "python -m flask --help" for help.

Error: no such option: --host


  • Python version: 2.7
  • Flask version: 1.1.1
  • Werkzeug version: N/A
  • Platform: Windows
@davidism davidism transferred this issue from pallets/flask Jul 10, 2019
@davidism davidism transferred this issue from pallets/werkzeug Jul 10, 2019
@davidism davidism added this to the 1.1.2 milestone Jul 10, 2019
Copy link

@davidism davidism commented Jul 10, 2019

We can add args=sys.argv[1:] back in with a note about the Click issue so we can remove it when that's addressed.


Copy link

@davidism davidism commented Apr 3, 2020

Finally released 1.1.2 with this.


@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants