buttplugio / buttplug-py

Python implementation of core message system and client for the Buttplug Sex Toy Protocol Standard
https://buttplug-py.docs.buttplug.io
Other
67 stars 10 forks source link

client.device_removed_handler throws AttributeError("'dict' object has no attribute 'remove'") #6

Closed Fedack closed 4 years ago

Fedack commented 4 years ago

When client.device_removed_handler += device_removed is called, the error below is thrown.

DeviceRemoved(device_index=0) Task exception was never retrieved future: <Task finished coro=<ButtplugClientWebsocketConnector._consumer_handler() done, defined at /usr/local/lib/python3.7/dist-packages/buttplug/client/websocket_connector.py:24> exception=AttributeError("'dict' object has no attribute 'remove'") created at /usr/lib/python3.7/asyncio/tasks.py:325> source_traceback: Object created at (most recent call last): File "Buttplug_Example.py", line 186, in asyncio.run(main(), debug=True) File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/usr/lib/python3.7/asyncio/base_events.py", line 571, in run_until_complete self.run_forever() File "/usr/lib/python3.7/asyncio/base_events.py", line 539, in run_forever self._run_once() File "/usr/lib/python3.7/asyncio/base_events.py", line 1767, in _run_once handle._run() File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "Buttplug_Example.py", line 44, in try_connect await client.connect(connector) File "/usr/local/lib/python3.7/dist-packages/buttplug/client/client.py", line 85, in connect await self.connector.connect() File "/usr/local/lib/python3.7/dist-packages/buttplug/client/websocket_connector.py", line 22, in connect asyncio.create_task(self._consumer_handler()) File "/usr/lib/python3.7/asyncio/tasks.py", line 325, in create_task return loop.create_task(coro) Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/buttplug/client/websocket_connector.py", line 37, in _consumer_handler await self._notify_observers(bp_msg) File "/usr/local/lib/python3.7/dist-packages/buttplug/client/connector.py", line 52, in _notify_observers await obs._handle_message(msg) File "/usr/local/lib/python3.7/dist-packages/buttplug/client/client.py", line 176, in _handle_message await self._parse_message(msg) File "/usr/local/lib/python3.7/dist-packages/buttplug/client/client.py", line 144, in _parse_message self.devices.remove(dr.device_index) AttributeError: 'dict' object has no attribute 'remove `

qdot commented 4 years ago

Wow. Even my linter was yelling about this and I didn't catch it, thanks.

I expect there will probably be a 0.0.2 by the end of the weekend, as well as another version or 3 of intiface-cli-rs.

Fedack commented 4 years ago

Thanks a lot :)