+ 2
EOFError
What is EOF ? How to fix EOFError ?
4 odpowiedzi
+ 2
you should use try/except when reading your input string, and if an EOF error has been risen you could set the check to an empty string before printing its content, for example:
try : 1
check = raw_input ("would you li 2
except EOFError : 3
print ("Error: EOF or empty inpu 4
check = "" 5
print check
+ 2
exception EOFError. Raised when one of the built-in functions ( input() or raw_input() ) hits an end-of-file condition (EOF) without reading any data. (N.B.: the file.read() and file.readline() methods return an empty string when they hit EOF.) exception FloatingPointError. Raised when a floating point operation fails.
+ 2
EOF happens when there is something that needs to be read but there is no closing of inverted commas or brackets, for example.
In input(), it is sys.stdin, the file for inputting.
When your code is the one doing that, your __file__ gives EOFError
+ 2
End Of File Error.
You can read about Python Errors here:
https://docs.python.org/2/library/exceptions.html
Also, if you show us a specific code where the error occurs, we can help you find out why :)