Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • Re: EOFError from input( )

$
0
0
If I stirp it back further to:

Code:

while True :    try :        x = input()        print(x)    except KeyboardInterrupt :        break
It runs fine in an interactive session but fails with that error when run in a situation where stdin (which input()) reads is not available.

python tst.py works.
python tst.py &, python tst.py < /dev/null, starting the code in the foreground then switching it to the background, etc fail. I've not tested running it from an IDE.

So... how are you running that code?

Statistics: Posted by thagrol — Sun Mar 17, 2024 2:10 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles