0

Enter the text:

Traceback (most recent call last):
  File "caesarCipher.py", line 16, in <module>
    text=input("Enter the text: ")
EOFError: EOF when reading a line

how can I fix this ? Thank you

4
  • 1
    What is the command you are using to run the container? Commented May 6, 2020 at 14:42
  • docker run cipher #where cipher is the name of the image Commented May 6, 2020 at 14:44
  • Inside docker you should not get data from terminal. You should create rest api or any other kind of service. Commented May 6, 2020 at 14:44
  • Make sure the container is run with the -ti arguments. Commented May 6, 2020 at 14:50

2 Answers 2

1

You should run your container with the -it flags (interactive terminal). This will allow you to interact with the process running inside the container.

For example:

foo.py

x = input('Enter some input: ')
print(x)

Dockerfile

from python

COPY foo.py .

ENTRYPOINT python foo.py

Usage

$ docker build . -t foo
$ docker run -it foo
Enter some input: foo
foo
$
Sign up to request clarification or add additional context in comments.

Comments

0

I guess the problem that you defined your script to be the entrypoint of your container. Inside the script the input function expects to have either a tty or a stream.

Running the script inside the container like this will do the trick:

docker run -it your_docker_container /path/to/your/script.py 

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.