Specifying arguments in launch.json for Python

Mind that providing arguments in launch.json works like described until you need key value args.

For example, the command

$ python main.py --verbose --name Test

has to be coded inside the launch.json arguments line like this:

"args": ["--verbose", "--name=Test"],

Find a nearly hidden hint in the "Watson" example in Python debug configurations in Visual Studio Code.


AAargh.. I just wasted 30 minutes of my life trying to figure out how to clearly define arguments with values. Sometimes things worked and sometimes total fail. I was just looking at the last error message: // Use IntelliSense to learn about possible attributes.

Turns out I had both my python program and the file launch.json active in the VScode open editor. I was making changes to launch.json, but FAILING to click on my python file before starting up the debugger.

Doh! Its not a surprise that a python interpreter fails when trying to run a .json file. Need to carefully read the complete error message. (The error message should say... hey you big dummy.. you should be using a .py file when executing python!)

Info shared here in case anybody else makes the same dumb mistake.