I have installed Visual Studio Code 1.23.1 and added extensions - Python, Code Runner.
With Code Runner, now I can see the Run Code symbol (triangle) and on highlighting it, I see the shortcut Ctrl + Alt + N. But when I try to use it to run the code that asks for user input, I can't find a way to provide the input. When I try to enter user input, I get error message "Cannot edit in read-only editor". I think this is because I am missing some configuration part for Code Runner like setting up PATH or some other Workspace settings.
Question: Please assist me in identifying what all configuration will I need to do and how?
I did select "Add Python 3.6 to PATH" while installing Python. I have attached screenshots for reference:
Note: Even now when I right click and select "Run Python File in Terminal" for the same program, I can enter user input fine and get the expected output.
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. :) Save this answer. Show activity on this post.
Your program is running in Output tab, therefore it is not possible to take input. Just enable Run in terminal in Visual Studio Code Settings.
First, select DevTools > Settings > Experiments > Open source files in Visual Studio Code, and then re-start DevTools. With this experiment enabled, suppose that in Microsoft Edge, you go to a local server (such as http://localhost or http://127.0.0.1 ), or open a local file.
If you select Start Collaboration session from the Session Details menu, an invitation link to your session will automatically be copied to your clipboard. You can share this link with anyone you'd like to collaborate with, as long as they also have VS Code and the Live Share Extension Pack downloaded.
Here's another alternative answer, I think more accurate.
Add following settings to your vscode user settings file:
"code-runner.executorMap": { "python": "$pythonPath -u $fullFileName", },
Check out this reference for some useful variables: Variables Reference
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