Skip to content

"RuntimeError: Task does not support set_exception operation" #26

@MagnusVesper

Description

@MagnusVesper

The run_controller_cli.py script works perfectly for 1 input. But after sending it, the script throws a runtime error.
Here is an example after I connected to the switch and simulated a b button press (which registered on the switch)

cmd >> b
[21:38:24] joycontrol.protocol _write::120 INFO - left change Grip/Order menu
[21:38:24] joycontrol.protocol _writer::190 WARNING - Writer exited...
[21:38:24] joycontrol.transport pause_writing::198 INFO - pause transport write
[21:38:24] joycontrol.transport read::94 ERROR - No data received.
[21:38:24] joycontrol.protocol connection_lost::262 ERROR - Connection lost.
[21:38:24] joycontrol.transport pause_writing::198 INFO - pause transport write
[21:38:24] asyncio default_exception_handler::1744 ERROR - Task exception was never retrieved
future: <Task finished name='Task-170' coro=<L2CAP_Transport.close() done, defined at ~/joycontrol-amiibo_edits/joycontrol/transport.py:208> exception=RuntimeError('Task does not support set_exception operation')>
Traceback (most recent call last):
  File "~/joycontrol-amiibo_edits/joycontrol/transport.py", line 224, in close
    await self._read_thread
  File "~/joycontrol-amiibo_edits/joycontrol/transport.py", line 78, in _reader
    await self._protocol.report_received(await self.read(), self._itr_sock.getpeername())
  File "~/joycontrol-amiibo_edits/joycontrol/transport.py", line 95, in read
    self._protocol.connection_lost()
  File "~/joycontrol-amiibo_edits/joycontrol/protocol.py", line 267, in connection_lost
    self._controller_state_sender.set_exception(NotConnectedError)
RuntimeError: Task does not support set_exception operation
[21:38:24] asyncio default_exception_handler::1744 ERROR - Exception in callback create_error_check_callback.<locals>.callback(<Task finishe...n operation')>) at ~/joycontrol-amiibo_edits/joycontrol/utils.py:55
handle: <Handle create_error_check_callback.<locals>.callback(<Task finishe...n operation')>) at ~/joycontrol-amiibo_edits/joycontrol/utils.py:55>
Traceback (most recent call last):
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "~/joycontrol-amiibo_edits/joycontrol/utils.py", line 58, in callback
    future.result()
RuntimeError: Task does not support set_exception operation

I then have to kill the script to end it.
It doesn't seem to matter how long I wait between connecting and sending the first input. It always works for exactly 1 input then throws this error.

Here is the full output starting from when I called the script:
(Note: I replaced the location of the joycontrol folder with ~ above to look cleaner. The text file has the real path.)
out.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions