Here is the extension for python I used in the vs code: python extension.
When I use the debugging feature provided by the extension, it will hang in there and do nothing if it needs input from the command line.
Where can I input values to step over the input statement in the vs code?
If you're only interested in debugging a Python script, the simplest way is to select the down-arrow next to the run button on the editor and select Debug Python File in Terminal.
Go to settings (ctrl+,) -> Search settings -> : Code-runner : Run in terminal - Check this and you will be able to run the code directly in the terminal which takes input. :) Show activity on this post.
Debugger extensions#VS Code has built-in debugging support for the Node. js runtime and can debug JavaScript, TypeScript, or any other language that gets transpiled to JavaScript.
The externalconsole
directive is deprecated. Use console
instead and indicate your preference for external this way:
"console": "externalTerminal"
The application output (and input) will go to a separate window so the VS Code debug console remains a pure python prompt where you can evaluate stuff during breakpoints.
The trick to getting this to work is on the extension's(Don Jayamanne's Python) wiki page. You have to include "externalConsole": true
setting in your launch.json
file's "name": "Python"
section.
The extension's wiki confirms that this does not work by default:
This allows for capturing of input from the console/terminal window applications, which isn't possible in the standard VSCode debugger.
Here are the steps to getting this to work:
.vscode
directory in what ever folder you have selected as your "Open Folder" in VS Code.pythonPath
parameter to the first configuration block. This is needed to have the debugger work at all.externalConsole
parameter to the same block. This is what is needed to have the debugger accept input. When you debug, a separate window will open outside of VS Code but works well otherwise. After you add both settings, the block should look something like this. I did not have to change anything else in the rest of the launch.json file.
{ "name": "Python", "type": "python", "request": "launch", "stopOnEntry": true, "program": "${file}", "pythonPath": "C:/Users/igor/Documents/Tools/WinPython-32bit-3.4.3.7Slim/python-3.4.3/python.exe", "externalConsole": true, "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] },
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With