-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StopIteration Error for python >= 3.5 #160
Comments
You are trying to connect to a client at 5002. And you got a disconnect packet. (which is an Error in SocketIO-client sometimes sadly, dependent on the type of disconnect)- a ConnectionError I think. you need to trap that with try: . I use this client with Python3.5 and 3.6 so it is not a version issue. The code you are using seems confused? You are mixing structures. socketIO.on("data",....) tells your socketIO class to trap the "data" event and tells it to call the function on_aaa_response. eg inside a class subclassed from BaseNamespace
The point is that the documentation is giving you snippets and expecting you to put your own classes/structures around it. now for that namespace, add an event called messagename and an function call for action works HTH
except ConnectionError as ex: You have to import ConnectionError from SocketIO if you want it. |
hi i wonder i could get answer about my error ASAP. so i wondering around google and not found anything like this error it's only mentioning about not connect with socket.io server, connection refused, and etc. and no thing i found like mine. i wonder if this socketIO-client is not support for python version 3.5+, or there any possibility that make my code error ?
here the error trace i get
Traceback (most recent call last): File "clienio.py", line 10, in <module> socketIO = SocketIO('localhost', 5002, LoggingNamespace) File "/usr/local/lib/python3.5/dist-packages/socketIO_client-0.7.2-py3.5.egg/socketIO_client/__init__.py", line 353, in __init__ resource, hurry_interval_in_seconds, **kw) File "/usr/local/lib/python3.5/dist-packages/socketIO_client-0.7.2-py3.5.egg/socketIO_client/__init__.py", line 54, in __init__ self._transport File "/usr/local/lib/python3.5/dist-packages/socketIO_client-0.7.2-py3.5.egg/socketIO_client/__init__.py", line 62, in _transport self._engineIO_session = self._get_engineIO_session() File "/usr/local/lib/python3.5/dist-packages/socketIO_client-0.7.2-py3.5.egg/socketIO_client/__init__.py", line 76, in _get_engineIO_session transport.recv_packet())
StopIteration
DEBUG:socketIO-client:localhost:5002/socket.io [socket.io disconnect]
and here my code
import logging
from socketIO_client import SocketIO, LoggingNamespace
def on_aaa_response(*args):
print('on_aaa_response', args)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.basicConfig(level=logging.DEBUG)
socketIO = SocketIO('localhost', 5002, LoggingNamespace)
socketIO.on("data", on_aaa_response)
socketIO.wait(seconds=1)
thank you for advise
The text was updated successfully, but these errors were encountered: