VSCode I cannot 'Start Debugging' and 'Run Without Debugging'

Viewed 2325

I am currently using python in VSCode and when I press 'Start Debugging' or 'Run Without Debugging' this appears in my screen enter image description here and as I am a beginner I just pressed the top one (Carbon ComponentS) to Run however this appears in my screen enter image description here I don't know what I'm doing wrong, I have been trying for hours now but I cannot seem to find a solution. my launch.Json file looks like this enter image description here What is the problem and how can I fix this? It seems like it is not python's fault because it acts the same when I try to run c++ files too. Thank you.

It appears like this when I press the top right triangleenter image description here

1 Answers
  1. In VS Code, the debugging function of python code is provided by the "Python" extension. Therefore, please install and use the "Python" extension in VS Code.

    enter image description here

  2. Before debugging python, we need to configure the debugging file "launch.json":

 {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console":"integratedTerminal",
        }
    ]
}

debug:

enter image description here

Please refer to this document: Python debug configurations in Visual Studio Code.

Related