microsoft / ptvsd

Python debugger package for use with Visual Studio and Visual Studio Code.
Other
548 stars 68 forks source link

Error: no such option: --default #2101

Closed enigmadevs closed 4 years ago

enigmadevs commented 4 years ago

Environment data

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 commented 4 years ago

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

enigmadevs commented 4 years ago

No, ptvsd is not in this path.

R0Wi commented 4 years ago

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 commented 4 years ago

Try it with the prerelease version of the new debugger.

R0Wi commented 4 years ago

@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 commented 4 years ago

Ohh, you're hitting https://github.com/microsoft/ptvsd/issues/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 4 years ago

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