Built-in Exceptions
EOFError — exception class
Signals end of input before input() can read a line. This differs from reading an empty line, which yields an empty string, and from file.read(), which normally returns an empty sequence at EOF. Catch EOFError when this category is the recovery boundary; do not rely on the exact human-readable message.
Formal Syntax & Structure
python syntaxpython
EOFErrorReturn Value
type
The class object EOFError; this reference documents the class identity, not a universal constructor signature.
Working Example
Example Snippetpython
import iofrom unittest.mock import patchtry: with patch("sys.stdin", io.StringIO("")): input()except EOFError as error: print(type(error).__name__)