I have some simple code that works fine everywhere except the Debug Console on VS Code.
Here it is:
pounds = int(input("How much do you weigh in pounds? "))
kilos = pounds * 0.45359237
print("You weight " + str(kilos) + " kilograms.")
If you use the launch.json
configuration of "console": "internalConsole",
, then the output will go to the debug console, which doesn't work. If you do "console": "integratedTerminal"
, the output will work and it will go to the terminal, but, it will make a new debug console each time, and eventually it will stop working on the 33 time. I have the screenshot below. The error is not shown in the terminal, but in a pop-up. The error states:
The terminal process "C:\Program Files\Git\bin\bash.exe" terminated with exit code: 256.
So there are two problems:
- Debug console won't work with
input()
- Terminal makes too many debug consoles, causing it to error.
I am confused as to how anyone uses python on VS code, because I can't even get it to work. I guess I can delete the consoles each time it reaches 33, but that seems inefficient and not how VS Code was intended to be used.
According to the information you provided, when I use
"console": "integratedTerminal"
in VSCode, the results will be executed sequentially in the same terminal:When using
"internalConsole"
, the result will not be executed normally, because currently the debugging console in VSCode is only used to display output.In addition, we can also use
"console": "externalTerminal"
, which can also accept input:Reference: console in VSCode.