Visual Studio Code: How debug Python script with arguments Visual Studio Code: How debug Python script with arguments python python

Visual Studio Code: How debug Python script with arguments


I think the --City and Auckland are used as a single argument. Maybe try separating them like so...

Single argument

    "args": ["--city","Auckland"]

Multiple arguments and multiple values

Such as:

--key1 value1 value2 --key2 value3 value4

Just put them into the args list one by one in sequence:

"args": ["--key1", "value1", "value2", "--key2", "value3", "value4"]


In Visual Studio, you can pass multiple parameter as convenient and natural way:

--trail=0 --g=0 --V="HO" --save_interval=10 --verbose=True

I just do not know why they will not support this in Visual Studio Code. To list arguments one by one is cumbersome and a bit silly. They just pass the arguments string to the Python parser, and things can be done easily.


--key1 value1 value2 --key2 value3 value4

can be passed as

"args": ["--key1=value1", "value2", "--key2=value3", "value4"]

(Combining the two answers by Pawan Kumar and Chunde Huang.)