Skip to content
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

TypeError: 'int' object is not subscriptable after latest updates May 15th #689

Closed
gil0109 opened this issue May 18, 2021 · 6 comments
Closed

Comments

@gil0109
Copy link

gil0109 commented May 18, 2021

After Recent update of Flask-SocketIO 5.0.3 (Although I think it maybe python-engineio and/or python-socketio)

Hi Team, I have the following occur after recent updates when using Flask-Socketio with Redis and/or RabbitMQ.

Traceback (most recent call last):
  File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/app-root/lib64/python3.8/site-packages/socketio/pubsub_manager.py", line 164, in _thread
    self._handle_emit(data)
  File "/opt/app-root/lib64/python3.8/site-packages/socketio/pubsub_manager.py", line 112, in _handle_emit
    super(PubSubManager, self).emit(message['event'], message['data'],
  File "/opt/app-root/lib64/python3.8/site-packages/socketio/base_manager.py", line 161, in emit
    for sid, eio_sid in self.get_participants(namespace, room):
  File "/opt/app-root/lib64/python3.8/site-packages/socketio/base_manager.py", line 45, in get_participants
    participants = ns[room[0]]._fwdm.copy() if room[0] in ns else {}
TypeError: 'int' object is not subscriptable

Pinning all three, resolves the issue in the interim.

Flask-SocketIO==5.0.2
python-engineio==4.1.0
python-socketio==5.2.1

@miguelgrinberg
Copy link
Owner

miguelgrinberg commented May 19, 2021

You need to follow the instructions and provide logs for the issue. Without the logs it is hard for me to understand what you are doing. See the troubleshooting section of the docs if you don't know how to enable logs. Thanks.

@gil0109
Copy link
Author

gil0109 commented May 19, 2021

I will review instructions but I did put the logs output there. I will edit to make it more visible. I am not sure how show how to replicate as our application is very complex.

@miguelgrinberg
Copy link
Owner

miguelgrinberg commented May 19, 2021

@gil0109 you posted a stack trace. What I require to troubleshoot an issue is the Socket.IO logs.

Side question. Are you using custom rooms? Are those room names strings? They should be strings.

@gil0109
Copy link
Author

gil0109 commented May 19, 2021

I will look at getting you socket.io logs if changing rooms to strings doesn't work but I think you found the issue.

At what point where they required to be strings? Latest update? as this code is working with until very recently...

socketio.emit('update_customer_list', {}, room=csr.office_id) where I believe the the csr.office_id is an int :( I should be able to change this in our code.

https://github.com/bcgov/queue-management/blob/a44ebfa617d5fd49556a829b940eacd9e807c3c2/api/app/resources/theq/citizen/citizen_specific_invite.py#L57

Thank you again for a great product..

Karim

@miguelgrinberg
Copy link
Owner

@gil0109 the argument is a room name, not a room number, so my assumption was that this would be a string. There is a recent code change that checks the type, because now you can also pass a list of room names when you emit. I can make this type check more generic, I just didn't think it would make sense to use numbers as room names.

@gil0109
Copy link
Author

gil0109 commented May 19, 2021

I just took that as any identification of the room regardless of type. We just used office_ids everywhere so it was an available variable. We can convert to string before sending or use another descriptor.

@miguelgrinberg miguelgrinberg transferred this issue from miguelgrinberg/Flask-SocketIO May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants