pythonvisual-studio-code

How to configure Visual Studio Code for Python debugger with arguments


I am new in visual studio code configuration settings. When I try to use vs code to debug python with arguments, I select Start Debugging and Python Debugger:Current File with Arguments. The quotes are not added to the interpreter path and fail to launch.

As you can see in the attached picture, quotes are added to the interpreter path if Python Debugger: Python file is selected for Start Debugging.

launch.json file is created by vs code automatically. I have no idea how to solve this problem. Any suggestion to solve it?

"version": "0.2.0", "configurations": [ { "name": "Python Debugger: Current File with Arguments", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", "args": "${command:pickArgs}" } ]

enter image description here


Solution

  • Use

          "args": [
                    "${command:pickArgs}"
                ],
    
    "configurations": [
        {
          "name": "Python Debugger: Current File with Arguments",
          "type": "debugpy",
          "request": "launch",
          "program": "${file}",
          "console": "integratedTerminal",
          "args": [
                    "${command:pickArgs}"
                ]
        }