qwertyquerty/pypresence

asyncio 'get_event_loop' thrown exception not handled

tmapes opened this issue · 4 comments

loop = asyncio.get_event_loop()

If get_event_loop throws due to no event loop existing at the time of call, a RuntimeError is thrown and not handled, which prevents the library from creating a new event loop to use.

Seen on an M1 Mac

This is reproducible by attempting to create a Presence while Discord isn't open.

My project is setup in a such a way that I'm intending things to work without Discord being open as I'd just create a new client once open, but without sending a custom loop this doesn't work while this exception isn't handled.

I think our event loop code needs updating regardless 😅

Will get to it eventually

rich_presence.update blocks on my machine. Any way to not block?

Using asyncio.wait_for would be nice