Connect Four EOF error

Hi, I try to solve the ‘learn python with a project’ challenge. I have to create a Connect Four game using python. For convenience, I write it in my preferred IDE and then copy it to Codecademy project. When I test it in my IDE, I do not have any error and everything works as it should. However, in Codecademy I get the following error:

What symbol do you play with: (X/O)? Traceback (most recent call last):
File “script.py”, line 138, in
disc = chooseDisc()
File “script.py”, line 100, in chooseDisc
disc = str(input("What symbol do you play with: (X/O)? "))
EOFError: EOF when reading a line

line 138 is where I call the function, line 100 is where the input is located in the following function:

def chooseDisc(): disc = '' while (disc != 'X' and disc != 'O'): disc = str(input("What symbol do you play with: (X/O)? ")) disc = disc.upper() return disc disc = chooseDisc() print(disc)

I have checked indentation and syntax. As I’ve said “It works in my computer…” :sweat_smile:

Project link: Connect Four with Python

1 Like

Unfortunately that’s a rather deceptive error that occurs when you use the input function on a codecademy workspace that doesn’t accept input (there’s no terminal to supply user input here).

I think the final step of this project actually sets up a terminal- https://www.codecademy.com/courses/connect-four/projects/connect-four-part-3-determining-the-winner-and-playing-the-game so you might have to test it there.

2 Likes