EDIT: Also refer to this - PyCharm: How to debug `raw_input()` input from keyboard?
I'm writing a code with for loop and taking raw_input
for turn in range(4):
guess_row[0] = int(raw_input("Player 1 Guess Row:"))
guess_col[0] = int(raw_input("Player 1 Guess Col:"))
guess_row[1] = int(raw_input("Player 2 Guess Row:"))
guess_col[1] = int(raw_input("Player 2 Guess Col:"))
But I'm getting the following error - End of File.
Traceback (most recent call last):
File "/Users/bonjugal/Desktop/Pycharm/Battleship_Game.py", line 52, in <module>
guess_row[0] = int(raw_input("Player 1 Guess Row:"))
EOFError
However this code is working fine when I run it from terminal. I read somewhere that this can happen if you don't close your file after reading/writing. It might have happened with me as well (but in a different project). What should I do in that case? I've tried restarting the IDE (Pycharm) as well.
Also, what is really happening in the background that this error is coming?
Found the answer. This was an issue specific to Jetbrains Pycharm. Apparently while using PyCharm where the run configuration includes "Show Command Line Afterwards", it works. The raw_input is blocked when this setting is off.
Edit Configuration > config > check show command line afterwards.
Refer to this.