You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was getting this trace-back message after cancelling a co-routine that was waiting on an evdev event:
Exception in callback <function EventIO._do_when_readable.<locals>.ready at 0xffff92de3560>
handle: <Handle cancelled>
Traceback (most recent call last):
File "usr/lib/python3.7/site-packages/evdev/eventio_async.py", line 22, in _set_result
asyncio.base_futures.InvalidStateError: invalid state
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run
File "usr/lib/python3.7/site-packages/evdev/eventio_async.py", line 17, in ready
File "usr/lib/python3.7/site-packages/evdev/eventio_async.py", line 32, in <lambda>
File "usr/lib/python3.7/site-packages/evdev/eventio_async.py", line 24, in _set_result
asyncio.base_futures.InvalidStateError: invalid state
I was observing a similar issue when working with Bluetooth devices that would sometimes get disconnected while I was waiting for events from them. In my case, the result were not the set_result calls, but the set_exception calls in /evdev/eventio_async.py, because they occured when future.done() was already True. Putting the set_exception calls in a try block like above did resolve my issue.
Activity
gfhcs commentedon Feb 7, 2023
I was observing a similar issue when working with Bluetooth devices that would sometimes get disconnected while I was waiting for events from them. In my case, the result were not the
set_resultcalls, but theset_exceptioncalls in/evdev/eventio_async.py, because they occured whenfuture.done()was alreadyTrue. Putting theset_exceptioncalls in a try block like above did resolve my issue.