3

new to Python and StackOverflow. Apologies if I miss any formalities.

I just created a one-line program to print Hello World but every time I run the program (using F5 or by going to Run->Start Debugging) the program runs and the panel at the bottom automatically switches to the Terminal window and the output gets displayed there and not in the Debug window. (Picture 1)

There are a lot of other things that get printed in the Terminal window which is why I want only the output to be printed in the Debug window. Also, that is how it is shown in the video of the course that I am doing (Picture 2).

print("Hello World")

My Debug window with no output of the program

Screenshot of the Course Video Output as it appears on the Debug Window

1 Answer 1

6

If you want to display the results in the debug console, you could open file launch.json in folder .vscode and add this setting: "console": "internalConsole",. (or open the setting pattern next to the debug button to open launch.json file. )

enter image description here

This is the complete content of my launch.json file:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "internalConsole",        
    }
  ]
}

Then, through the test, the result is displayed in the debug console. like this:

enter image description here

Reference: Python debug configurations in VSCode.

Sign up to request clarification or add additional context in comments.

1 Comment

This was exactly what I was looking for an even numerous google searches with all combinations and permutations of keywords couldn't help me find this. Thank you so much for your time! Very much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.