Python Script Using socketIO_client Library Encountering StopIteration Error After Volumio Update

Hello,

I have a Python script that uses the socketIO_client library to connect to my Volumio server. The script was working fine until about a week ago, which coincides with the Volumio version update to 3.695 on May 28, 2024. Since the update, I’ve been encountering a StopIteration error. Here’s the traceback:
Traceback (most recent call last):

  File "/Volumes/DATA1_INTERNE/devel/projects/pycharm/volumio_socketio_test/volumio3_bai_test1.py", line 12, in <module>
    socketIO = SocketIO('volumio.local', 3000, LoggingNamespace)
  File "/Volumes/DATA1_INTERNE/devel/projects/pycharm/volumio_socketio_test/venv/lib/python3.11/site-packages/socketIO_client/__init__.py", line 351, in __init__
    super(SocketIO, self).__init__(
  File "/Volumes/DATA1_INTERNE/devel/projects/pycharm/volumio_socketio_test/venv/lib/python3.11/site-packages/socketIO_client/__init__.py", line 54, in __init__
    self._transport
  File "/Volumes/DATA1_INTERNE/devel/projects/pycharm/volumio_socketio_test/venv/lib/python3.11/site-packages/socketIO_client/__init__.py", line 62, in _transport
    self._engineIO_session = self._get_engineIO_session()
  File "/Volumes/DATA1_INTERNE/devel/projects/pycharm/volumio_socketio_test/venv/lib/python3.11/site-packages/socketIO_client/__init__.py", line 75, in _get_engineIO_session
    engineIO_packet_type, engineIO_packet_data = next(
StopIteration

The error seems to occur when the socketIO_client library is trying to establish a connection. I’ve checked the server status, network connection, firewall settings, and the versions of Socket.IO server and the socketIO_client library, but everything seems to be in order. The server is reachable and other applications can connect to it without any issues.

Here’s the sample test code I’ve been using:

from socketIO_client import SocketIO, LoggingNamespace

def on_connect():
    print('Connected to Volumio')

def on_disconnect():
    print('Disconnected from Volumio')

def on_push_state(*args):
    print('State:', args)

socketIO = SocketIO('volumio.local', 3000, LoggingNamespace)
socketIO.on('connect', on_connect)
socketIO.on('disconnect', on_disconnect)
socketIO.on('pushState', on_push_state)

socketIO.wait()

Has anyone encountered this issue before or have any suggestions on how to resolve it? Any help would be greatly appreciated.

Thank you!

socket.io has been updated to v2.3, maybe your script require some adaptations

1 Like

Ok thank you!
I use now

pip install python-engineio==3.14.2 python-socketio==4.6.0

which is compatible with socket.io v2.3

1 Like