Python EOF Error when reading a line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Python EOF Error when reading a line

I typed these codes in the IDLE(Python 3.6 32-bit) on my laptop. It worked well and clearly on the laptop. After that, I copy&pasted them directly in here, code playground in Sololearn ver 1.3.1, the latest version, on my phone. But when I executed it on my phone, EOF Error is occuring when reading a line and the program just stop there. I searched for EOF Error on docs.python.org and it said: 'Raised when the input() function hits an end-of-file condition(EOF) without reading any data.

20th Apr 2017, 3:08 AM
Joel Bennett
Joel Bennett - avatar
5 Answers
+ 8
Code Playground only allow all user input at once just before running code, each entries separated by a new line... If you have 3 values to input, type: first value second one last ... on the code playground prompt box, and click on the button to validate and execute your code. If you need interractivity ( asking, answering before next ask and so on ), you cannot in code playground ^^
20th Apr 2017, 3:16 AM
visph
visph - avatar
+ 7
Easier than what stand for EOF ( End Of File )? Appart saying it's about data source in general, rather than file source specifically, I cannot :(
20th Apr 2017, 3:33 AM
visph
visph - avatar
+ 7
When you reach the end of a file/data source... In your case, this is particular, because in code playground inputs are read as a file/stream, as once input... so if you don't provide enough lines for the number of input required, this raise the EOF error, but doesn't occur in local real Python interpreter by this way ^^ It will mostly occurs when attempting to read more lines than exists in a file.
20th Apr 2017, 3:40 AM
visph
visph - avatar
+ 3
Oh, I didn't know that!! So the problem was the feature of this app, am I right?:) Thank you for your detailed answer and..Can you please explain the definition of EOF error in a more easier way?
20th Apr 2017, 3:27 AM
Joel Bennett
Joel Bennett - avatar
+ 1
Sorry.. I asked in a wrong way.. Can you please tell me when does this error occur more easily?
20th Apr 2017, 3:35 AM
Joel Bennett
Joel Bennett - avatar