asyncio.get_event_loop() deprecated in Python 3.10
FlyingDiver opened this issue · 3 comments
FlyingDiver commented
So the examples should probably be changed to use a supported method going forward. I'm not an asyncio expert, and all the variations I've tried using asyncio.get_running_loop() or asyncio.new_event_loop() have failed.
If anyone knows how this is supposed to work going forward, let me know and I'll test and update the docs.
tazle commented
I bumped into this when trying to update to 3.10, and got the following initialization working:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
asyncio.ensure_future(watchdog(), loop=loop)
asyncio.ensure_future(main(), loop=loop)
loop.run_forever()
where async def main():
initializes MQTTClient, connects etc.
FlyingDiver commented
Where are you getting "loop" from?