OliverF / mjpeg-relay

Relays any given MJPEG stream
MIT License
66 stars 23 forks source link

Docker container not working because of raw_input() call #23

Closed janecker closed 6 years ago

janecker commented 6 years ago

I tried running your project as a docker container and faced the problem that I received the following exception:

Exception in thread Thread-3 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
  File "/usr/local/lib/python2.7/threading.py", line 754, in run
  File "/usr/src/app/app/httprequesthandler.py", line 102, in acceptClients
  File "/usr/local/lib/python2.7/socket.py", line 207, in accept
<type 'exceptions.TypeError'>: 'NoneType' object is not callable

I traced down the issue to the call of raw_input() that is not working, because there is no interactive input in a docker container. I am not very used to python so I am not completly sure what the purpose of the last part of the script is:

try:
    while raw_input() != "quit":
        continue
    quit()
except KeyboardInterrupt:
    quit()
except EOFError:
    #this exception is raised when ctrl-c is used to close the application on Windows, appears to be thrown twice?
    try:
        quit()
    except KeyboardInterrupt:
        os._exit(0)

Is it just for shutting down the script if a keyboard interrupt (ctrl+c) is detected? If s I would look for an alternative so the script can run properly as docker container.

Silex commented 6 years ago

How do you run the docker image? What is your docker version?

Try adding the -it flags when running the container.

Silex commented 6 years ago

Okay I've ran some tests, it requires the -i flag at least.

janecker commented 6 years ago

Hi, thanks for the fast feedback, adding the -it option solved the issue. Thanks!