samclane / Discordia

MUD (Multi-User Dungeon) for Discord.
GNU General Public License v3.0
20 stars 5 forks source link

ValueError: set_wakeup_fd only works in main thread #2

Closed samclane closed 5 years ago

samclane commented 5 years ago

When running on Raspbian Stretch, the Discord-Thread quickly throws this exception:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/home/pi/.pyenv/versions/3.7.2/lib/python3.7/asyncio/unix_events.py", line 92, in add_signal_handler
    signal.set_wakeup_fd(self._csock.fileno())
ValueError: set_wakeup_fd only works in main thread

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.pyenv/versions/3.7.2/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/pi/.pyenv/versions/3.7.2/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/.virtualenvs/discordia/lib/python3.7/site-packages/discord/client.py", line 572, in run
    loop.add_signal_handler(signal.SIGINT, lambda: loop.stop())
  File "/home/pi/.pyenv/versions/3.7.2/lib/python3.7/asyncio/unix_events.py", line 94, in add_signal_handler
    raise RuntimeError(str(exc))
RuntimeError: set_wakeup_fd only works in main thread

This probably requires that the Discord-Thread be the main thread, which is problematic to Quit (as opposed to the OpenCV window, at least).

This issue also seems to be the inverse of Issue #1, which again is odd, considering Mac OS is Unix-based and theoretically should be complaining about the same thing.

samclane commented 5 years ago

The current version just goes for the Ctrl+C method of closing the program. As such, it currently works on the Raspberry Pi without issue.