The output when I run code in VSCode gets displayed in the terminal window instead of the output window
Question:
I tried some of the solutions posted earlier in similar questions but none of them seem to work for me. My code is in Python 3.8 and I am using the latest version of VSCode. Thanks.
Answers:
When running python code in VS Code, it executes the running command in the VS Code internal terminal ( TERMINAL
) by default. It is a terminal that allows user interaction, but "OUTPUT
" is an output terminal, which cannot receive user input.
For how to make the output display in "OUTPUT
" in VS Code:
Please use the "Code Runner
" extension in VS Code, which uses "OUTPUT
" by default:
In addition, if you want to use relatively clean output, you could also use "DEBUG CONSOLE
".
Please use in "launch.json": "console": "internalConsole",
then click F5
to debug the code:
Make sure you’ve the code runner extension installed. If yes then,enter image description here
Go to settings ,
1.search Terminal
2. scroll to the last line
3. uncheck code run in terminal
Install "Code Runner" extension.
- VS Code -> Extensions (Ctrl+Shift+X) in the most left panel -> text box "Search Extensions in Marketplace" -> Code Runner -> Install
Setting up Code Runner
- VS Code -> File -> Preferences -> Settings (Ctrl+,) -> text box "Search settings" -> Code Runner -> ensure that checkbox for "Code-runner: Run In Terminal" is unchecked.
Running Python Scripts
- Prepare a Python code you want to run -> Press Ctrl+Alt+N to run the code via Code Runner.
- If the shortcut Ctrl+Alt+N is already taken e.g. by another software, you can change the shortcut
- File -> Preferences -> Keyboard Shortcuts (Ctrl+K Ctrl+S) -> search: Code Runner -> Run Code
If you want to clear previous output (from OUTPUT window) -> File -> Preferences -> Settings (Ctrl+,) -> text box "Search settings" -> Code Runner -> ensure that checkbox for "Code-runner: Clear Previous Output" is checked.
I tried some of the solutions posted earlier in similar questions but none of them seem to work for me. My code is in Python 3.8 and I am using the latest version of VSCode. Thanks.
When running python code in VS Code, it executes the running command in the VS Code internal terminal ( TERMINAL
) by default. It is a terminal that allows user interaction, but "OUTPUT
" is an output terminal, which cannot receive user input.
For how to make the output display in "OUTPUT
" in VS Code:
Please use the "Code Runner
" extension in VS Code, which uses "OUTPUT
" by default:
In addition, if you want to use relatively clean output, you could also use "DEBUG CONSOLE
".
Please use in "launch.json": "console": "internalConsole",
then click F5
to debug the code:
Make sure you’ve the code runner extension installed. If yes then,enter image description here
Go to settings ,
1.search Terminal
2. scroll to the last line
3. uncheck code run in terminal
Install "Code Runner" extension.
- VS Code -> Extensions (Ctrl+Shift+X) in the most left panel -> text box "Search Extensions in Marketplace" -> Code Runner -> Install
Setting up Code Runner
- VS Code -> File -> Preferences -> Settings (Ctrl+,) -> text box "Search settings" -> Code Runner -> ensure that checkbox for "Code-runner: Run In Terminal" is unchecked.
Running Python Scripts
- Prepare a Python code you want to run -> Press Ctrl+Alt+N to run the code via Code Runner.
- If the shortcut Ctrl+Alt+N is already taken e.g. by another software, you can change the shortcut
- File -> Preferences -> Keyboard Shortcuts (Ctrl+K Ctrl+S) -> search: Code Runner -> Run Code
If you want to clear previous output (from OUTPUT window) -> File -> Preferences -> Settings (Ctrl+,) -> text box "Search settings" -> Code Runner -> ensure that checkbox for "Code-runner: Clear Previous Output" is checked.