python-socketio: socketio.exceptions.ConnectionError: OPEN packet not returned by server
I want to run my Socket-IO Client with Docker, but I get the following error message when trying to connect to my Socket-IO Server (written in JavaScript).
Traceback (most recent call last):
File "client.py", line 14, in <module>
sio.connect('http://' + server_address + ':3000')
File "/usr/local/lib/python3.8/dist-packages/socketio/client.py", line 280, in connect
raise exceptions.ConnectionError(exc.args[0]) from None
socketio.exceptions.ConnectionError: OPEN packet not returned by server
Socket-IO Client:
import socketio
import os, sys
# Connect to socket io server
sio = socketio.Client()
server_address = os.environ.get('SERVER_ADDRESS')
if server_address:
print('http://' + server_address + ':3000')
sio.connect('http://' + server_address + ':3000')
else:
sio.connect('http://<default ip>:3000')
Dockerfile:
FROM ubuntu:latest
ARG SERVER_ADDRESS
ENV SERVER_ADDRESS $SERVER_ADDRESS
RUN apt-get update -y && apt-get install -y python3 python3-pip
RUN pip3 install pyserial python-socketio requests
COPY ./flir-config .
COPY ./find_serial_device.py .
CMD ["python3", "client.py"]
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (7 by maintainers)
@Nathan1258 My Socket.IO server is written in JavaScript using socket.io v.2.3.0. To communicate with the server in Python, the right versions for python-socketio and python-engineio need to be chosen.
In my case, I forgot to fix the python-engineio version to 3.x, which resulted in the error. To fix it, I installed version 3.14.2.
did you pin the version of python-engineio to a compatible version? It should be a 3.x for you.
Ah! Thank you, yep the different versions was doing me over too !
No I didn’t fix the python-engineio version so it used 4.0.0 (Latest). I now fixed it to 3.14.2 and it works now. Thanks for your help.