qwertyquerty / pypresence

A complete Discord IPC and Rich Presence wrapper library in Python!
https://qwertyquerty.github.io/pypresence/html/index.html
MIT License
652 stars 76 forks source link

ValueError: set_wakeup_fd only works in main thread of the main interpreter #204

Closed brostosjoined closed 1 year ago

brostosjoined commented 1 year ago

ERROR: Error initing plugin: 'discordrp.DiscordRP'. root call: context: real-time: 3189 sim-time: base-time: PRINTED-FROM: File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_meta.py", line 219, in _handle_scan_results self._scan_complete_cb() File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_app.py", line 491, in on_meta_scan_complete self._update_state() File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_app.py", line 518, in _update_state self.on_app_running() File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_app.py", line 479, in on_app_running self.plugins.on_app_running() File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_plugin.py", line 86, in on_app_running self.load_plugins() File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_plugin.py", line 170, in load_plugins _error.print_exception(f"Error initing plugin: '{plugkey}'.") File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_error.py", line 168, in print_exception stackstr = ''.join(traceback.format_stack()) EXCEPTION: Traceback (most recent call last): File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\ba_plugin.py", line 156, in load_plugins plugin = cls() File "C:\Users\Admin\AppData\Local\BombSquad\mods\discordrp.py", line 105, in init self.rpc_thread = RpcThread() File "C:\Users\Admin\AppData\Local\BombSquad\mods\discordrp.py", line 53, in init self.rpc = pypresence.Presence(963434684669382696) File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\pypresence\presence.py", line 13, in init super().init(*args, **kwargs) File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\pypresence\baseclient.py", line 33, in init self.update_event_loop(get_event_loop()) File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\ba_data\python\pypresence\utils.py", line 63, in get_event_loop return asyncio.ProactorEventLoop() File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\lib\asyncio\windows_events.py", line 315, in init super().init(proactor) File "C:\Users\Admin\Desktop\games\BombSquad_Windows_1.7.19\lib\asyncio\proactor_events.py", line 635, in init signal.set_wakeup_fd(self._csock.fileno()) ValueError: set_wakeup_fd only works in main thread of the main interpreter

brostosjoined commented 1 year ago

So the discordrp is the plugin for discord rich presence for a game called Bombsquad i configured everything correctly and brings up that error .Microsoft Windows 11 [Version 10.0.22621.1265]

brostosjoined commented 1 year ago

ERROR: failed to update presence root call: <not in logic thread; context unavailable> PRINTED-FROM: File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap self._bootstrap_inner() File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/home/kipusiii/.bombsquad/mods/discordrp.py", line 71, in run self._update_presence() File "/home/kipusiii/.bombsquad/mods/discordrp.py", line 82, in _update_presence print_error('failed to update presence', include_exception=True) File "/home/kipusiii/.bombsquad/mods/discordrp.py", line 27, in print_error ba.print_exception(err) File "/mnt/c/Users/Admin/Desktop/games/BombSquad_Linux_x86_64_1.7.19/ba_data/python/ba/_error.py", line 168, in print_exception stackstr = ''.join(traceback.format_stack()) EXCEPTION: ^CAL lib: (EE) alc_cleanup: 1 device not closed Traceback (most recent call last): File "/home/kipusiii/.bombsquad/mods/discordrp.py", line 76, in _update_presence self._do_update_presence() File "/home/kipusiii/.bombsquad/mods/discordrp.py", line 85, in _do_update_presence self.rpc.update( File "/mnt/c/Users/Admin/Desktop/games/BombSquad_Linux_x86_64_1.7.19/ba_data/python/pypresence/presence.py", line 35, in update self.send_data(1, payload) File "/mnt/c/Users/Admin/Desktop/games/BombSquad_Linux_x86_64_1.7.19/ba_data/python/pypresence/baseclient.py", line 98, in send_data self.sock_writer.write( AttributeError: 'NoneType' object has no attribute 'write'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/kipusiii/.bombsquad/mods/discordrp.py", line 79, in _update_presence self.rpc.connect() File "/mnt/c/Users/Admin/Desktop/games/BombSquad_Linux_x86_64_1.7.19/ba_data/python/pypresence/presence.py", line 44, in connect self.update_event_loop(get_event_loop()) File "/mnt/c/Users/Admin/Desktop/games/BombSquad_Linux_x86_64_1.7.19/ba_data/python/pypresence/utils.py", line 52, in get_event_loop loop = asyncio.get_event_loop() File "/usr/lib/python3.10/asyncio/events.py", line 656, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.' RuntimeError: There is no current event loop in thread 'Thread-13'

brostosjoined commented 1 year ago

That is on Ubuntu 22.04.2 LTS through WSL2

brostosjoined commented 1 year ago

for the ubuntu the fix was already merged Hunter2809:master so i guess the latest download is outdated

brostosjoined commented 1 year ago

The issue was with the application not pypresence module so I close