Write Python. Understand every error.

Open the editor

Error guide · Other errors

EOFError: EOF when reading a line

The program called input() but there was no more input to read.

Example

a = input()
b = input()
print(a + b)

With the program input: 5

What Python says

EOFError: EOF when reading a line

As printed by Python 3.12. Other versions may word it slightly differently.

Try this code in Py-CRAFT

Why it happens

EOF means "end of file". Each input() reads one line. In Py-CRAFT, the lines come from the Program input box, so if the program asks for more lines than you typed, it fails.

How to fix it

a = input()
b = input()
print(a + b)

Output: 57

Tips

Learn the ideas behind it

Other common errors

Share this page: