microsoft/ptvsd

Error: no such option: --default

enigmadevs opened this issue · 7 comments

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 microsoft/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.

@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.

No, ptvsd is not in this path.

R0Wi commented

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.

R0Wi commented

@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?

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 commented

@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).