Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Error: no such option: --default #2101

Closed
enigmadevs opened this issue Mar 1, 2020 · 7 comments
Closed

Error: no such option: --default #2101

enigmadevs opened this issue Mar 1, 2020 · 7 comments

Comments

@enigmadevs
Copy link

Environment data

  • VS Code version: 1.42.1
  • Extension version (available under the Extensions sidebar): Python 2020.2.64397
  • OS and version: Windows 10 64bit
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7.14
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Relevant/affected Python packages and their versions: XXX
  • Relevant/affected Python-related VS Code extensions and their versions: Flask 1.1.1
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version vscode-python#3977): XXX
  • Value of the python.languageServer setting: XXX

Expected behaviour

It should start to debug my project

Actual behaviour

I receive this error:
C:\Users\s3rgy0\envs\venv\Scripts\python.exe c:\Users\s3rgy0.vscode\extensions\ms-python.python-2020.2.64397\pythonFiles\ptvsd_launcher.py --default --client --host localhost --port 51765 -m flask run --no-debugger --no-reload --host=192.168.0.163 --port=3002
Usage: python -m flask [OPTIONS] COMMAND [ARGS]...
Try "python -m flask --help" for help.

Error: no such option: --default

Steps to reproduce:

  1. I followed this tutorial https://code.visualstudio.com/docs/python/tutorial-flask step by step but i used virtualenv instead of env because my project is written in python 2.7
  2. Start debugging

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

C:\Users\s3rgy0\envs\venv\Scripts\python.exe c:\Users\s3rgy0\.vscode\extensions\ms-python.python-2020.2.64397\pythonFiles\ptvsd_launcher.py --default --client --host localhost --port 51765 -m flask run --no-debugger --no-reload --host=192.168.0.163 --port=3002
Usage: python -m flask [OPTIONS] COMMAND [ARGS]...
Try "python -m flask --help" for help.

Error: no such option: --default

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

I've no output because i can't debug

I don't know if this is a bug but i couldn't find any info about this error anywhere. I could debug flask with vscode in os x without problems, but in windows i receive this error. I repeat the tutorial multiple times but the result is always the same. The tutorial is written by python 3 but i changed the "env" to "virtualenv", i don't know if i should make any other change.

i think the problem is with python extension but i didn't be able to find any config file to modify this command:

C:\Users\s3rgy0\envs\venv\Scripts\python.exe c:\Users\s3rgy0.vscode\extensions\ms-python.python-2020.2.64397\pythonFiles\ptvsd_launcher.py --default --client --host localhost --port 51765 -m flask run --no-debugger --no-reload --host=192.168.0.163 --port=3002

If i could remove this options: "--default --client --host localhost --port 51765" it should work, but i don't know how.

Please help.

Thanks.

@karthiknadig
Copy link
Member

@enigmadevs can you check if you have ptvsd installed in C:\Users\s3rgy0\envs\venv\Scripts\python.exe environment? if so can you uninstall it.

@brettcannon brettcannon transferred this issue from microsoft/vscode-python Mar 2, 2020
@enigmadevs
Copy link
Author

No, ptvsd is not in this path.

@R0Wi
Copy link

R0Wi commented Mar 8, 2020

I have the same problem. I found out that the command would work work fine in python 3.8 environment. The problem is that my project is not compatible with python 3.8 and therefore i have to use python 2.7.

@int19h
Copy link
Contributor

int19h commented Mar 13, 2020

@R0Wi
Copy link

R0Wi commented Mar 23, 2020

@int19h thanks for your feedback. Now i'm getting another error

PS C:\>  ${env:DEBUGPY_LAUNCHER_PORT}='55945'; & 'C:\Python27\python.exe' 'c:\...\ms-python.python-2020.4.68586-dev\pythonFiles\lib\python\debugpy\no_wheels\debugpy\launcher' '-m' 'flask' 'run' '--no-debugger' '--no-reload' 
Usage: python -m flask [OPTIONS] COMMAND [ARGS]...
Try 'python -m flask --help' for help.

Error: no such option: --connect

Do you have a idea how i can get this running?

@int19h
Copy link
Contributor

int19h commented Mar 24, 2020

Ohh, you're hitting #1574! Unfortunately, it's a bug in Flask (or rather Click) that we can't do much about. Flask already made a workaround for it, but they haven't shipped a stable release (1.1.2) with that yet.

If you can downgrade Flask to 1.0.3, that's one possible workaround.

@R0Wi
Copy link

R0Wi commented Mar 30, 2020

@int19h thanks for your advice! Indeed downgrading Flask to 1.0.3 solved the problem. I'm able to debug even with the non-preview debugger for python now (in my case python debugger has currently version 2020.3.69010).

@int19h int19h closed this as completed Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants