Python 3: Eof When Reading A Line (visual Studio Code)
Solution 1:
I reproduced the problem you described:
Reason: When we use "console": "internalConsole",
the result will be output to "DEBUG CONSOLE
", and this terminal of VSCode is currently only used for display output. When the code needs to be input but input is not received, it will throw "EOF
" "(End of file), "There is an unexpected error at the end of the file".
Answer : please change the output mode of the debugging code. (in settings.json
file)
For the code that needs to be entered, we can use
"console": "integratedTerminal",
or use
"console": "externalTerminal",
Reference: console in VSCode.
Solution 2:
Using the Microsoft Visual Studio Code (and the debug window for code that does not require input), I right-clicked on the code and from the submenu selected the Run Python File in Terminal option. Rather than executing in the Debug tab, it executed in the Terminal tab. I was able to enter an input there and test the input value.
Post a Comment for "Python 3: Eof When Reading A Line (visual Studio Code)"