'How to fix "EOF when reading a line" using plugin Python-Notepad++
I'm using python plugin in Notepad++ and trying to use input()
in a script I get this error
>>> name=input()
Traceback (most recent call last):
File "<console>", line 1, in <module>
EOFError: EOF when reading a line
I've tried solutions in other threads of SO like using try/except block as below, but still getting the error. Is there a workaround for this? Thank you.
>>> try:
... input("Please enter something")
... except:
... break
File "<console>", line 4
SyntaxError: 'break' outside loop
>>> try:
... name=input()
... except EOFError:
... break
File "<console>", line 4
SyntaxError: 'break' outside loop
Traceback (most recent call last):
UPDATE
>>> try:
... input("Please enter something: ")
... except EOFError as e:
... print(e)
...
Please enter something: EOF when reading a line
>>> abc
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'abc' is not defined
Solution 1:[1]
change break
to pass
and you should pass that error or use
except EOFError as e:
print(e)
so you will know when it happened. All I can help as I can't replicate it here, works just fine for me. Use break
only in loops.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jakub |