1

I just installed python onto my computer and I'm testing it with some simple code like print("test") and when I try to run the code through the Terminal - Run Active File it opens a command prompt window and closes it instantly. It only slowed down once enough for me to quickly read it but automatically closes.

How do I get the window to stop closes or is there another way to run python code in VS Code.

Any help will be much appreciated.

Joey
  • 1,436
  • 2
  • 19
  • 33

1 Answers1

0

In VSCode you can customize the settings for debugging Python code. For this you have to click on debugging on the left sidebar and then on the round icon in the upper left corner.

This will open the file launch.json. There you can customize the settings for debugging.

Here is what it should look like:

enter image description here

Now if you set "console" to "none", VSCode uses the internal debugging console, while setting it to "integratedTerminal" uses the the terminal within VSCode and "externalTerminal" uses the default terminal of your OS.


After you have modified launch.json you can choose one of the debug configurations from the dropdown menu as shown below.

enter image description here

For further information you can read through the official documentation about debugging Python in VSCode.

Joey
  • 1,436
  • 2
  • 19
  • 33