question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EOF error in python 2.7 (not in python 3.5)

See original GitHub issue

I got an error when running consoleLabel on Jupyter notebook (my Jupyter version is 4.1.0) using Python 2.7 as follows.

dedupe.consoleLabel(deduper)

Here is an error:

EOFError                                  Traceback (most recent call last)
<ipython-input-41-5f16b23568e5> in <module>()
----> 1 dedupe.consoleLabel(deduper)

~/anaconda2/lib/python2.7/site-packages/dedupe/convenience.pyc in consoleLabel(deduper)
     55             while not valid_response:
     56                 print('(y)es / (n)o / (u)nsure / (f)inished', file=sys.stderr)
---> 57                 label = input()
     58                 if label in ['y', 'n', 'u', 'f']:
     59                     valid_response = True

EOFError: EOF when reading a line

I’m wondering if there is an error for others who use Python 2.7 also. Or, the error is raised because of Jupyter notebook. I see no error when using Python 3.5.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nateyodercommented, Jan 10, 2017

All good. I ended up getting it to work by basically doing exactly what you suggested by replacing line 4 with:

try:
    input = raw_input
except NameError:
    pass

Thanks!

0reactions
titipatacommented, Jan 10, 2017

Hello @nateyoder! it has been quite a while on this issue. I don’t remember how I solved an issue actually. I’m not sure if changing convenience.py#L56 from input to raw_input will help solve the problem or not. In this case, you might have to download dedupe, fix L56, and use setup.py in order to install the library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Correcting EOF error in python in Codechef - GeeksforGeeks
EOF stands for End Of File. Well, technically it is not an error, rather an exception. This exception is raised when one of...
Read more >
How to solve EOF Error in the below code? - Stack Overflow
I have solved the issue using try and except block as follows: from datetime import datetime try: a = int(input()) while a !=...
Read more >
Why would the EOFError exception be raised in Python 3, and ...
In simple terms, it means that you have reached the end of a file, such as using file.readlines(). It's not a bad error,...
Read more >
EOFError: EOF when reading a line - DEV Community ‍ ‍
In Python, an EOFError is an exception that gets raised when functions such as input() or raw_input() in case of python2 return end-of-file ......
Read more >
Built-in Exceptions — Python 3.11.1 documentation
Raised when the input() function hits an end-of-file condition (EOF) without reading any data. (N.B.: the io.IOBase.read() and io.IOBase.readline() methods ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found