skip to Main Content

When I run my code in Visual Studio Code using the run button, it is stuck on the Python Debugger: debug using launch.json.
However, I just want it to run my code through the coderunner.
this picture shows my problem. Notice the run has a bug on it and I just want it to run regularly

I do not know what causes this problem and I do not know how to fix it.

2

Answers


  1. Click the drop-down arrow next to the button, and choose "Run Python File":

    drop-down list

    Login or Signup to reply.
  2. You can specify a "default build task" in VS Code to run Python code (without debugging) by pressing Ctrl+Shift+B on the keyboard.

    To add the task, go to (in the main menue of VS Code)
    -> Terminal
    -> Configure Default Build Task
    -> Create tasks.json file from template
    -> Others,
    and replace the existing code in tasks.json by the code below.

    With a Python file opended in a tab in VS Code, you can run the respective file by pressing Ctrl+Shift+B on the keyboard. Feedback like print statements etc will appear in the terminal.

    The code below is a slightly modified version of this answer.

    {
        // https://code.visualstudio.com/docs/editor/tasks
        "version": "2.0.0",
        "tasks": [
            {
                "command": "${command:python.interpreterPath} ${file}",
                "type": "shell",
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "presentation": {
                    "reveal": "always",
                    "panel": "new",
                    "focus": true
                },
                "problemMatcher": [],
                "label": "Run File"
            }
        ]
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search