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.
You can provide input by telling code runner to use the terminal. To do this, there is a setting called code-runner.runInTerminal
, set to false by default, that you can set to true.
There is one more thing that you should watch out for if you are using a windows command line for the terminal like CMD or PowerShell. If your project directory has spaces in it (e.g. C:\Example Test) you will get an error. To fix this, you need to add escaped quotation marks (\"
) around the directory path variables (normally $dir
or $workspaceRoot
) found under the setting code-runner.executorMap
and code-runner.executorMapByFileExtension
in the user settings.