1

In an Ubuntu environment, I am hosting a script on a web server and I'm trying to run the script without writing it to a file using the line wget -O - -o /dev/null 0.0.0.0:8000/myscript | python

The script starts off running just fine, until I get to a use of input() where I get this error

Traceback (most recent call last):
  File "<stdin>", line 629, in <module>
EOFError: EOF when reading a line

I did a little reading on sys.stdin but I'm not finding a clear solution. What can exactly is happening here and how can I work around it?

1 Answer 1

1

Found the solution here: Pipe input to Python program and later get input from user

I added the line sys.stdin = open("/dev/tty") and now it seems to work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.