Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio.get_event_loop() deprecated in Python 3.10 #95

Open
FlyingDiver opened this issue Jan 31, 2022 · 3 comments
Open

asyncio.get_event_loop() deprecated in Python 3.10 #95

FlyingDiver opened this issue Jan 31, 2022 · 3 comments

Comments

@FlyingDiver
Copy link
Contributor

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
Copy link

tazle commented Feb 2, 2022

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
Copy link
Contributor Author

Where are you getting "loop" from?

@tazle
Copy link

tazle commented Feb 2, 2022

Oops, sorry, missed one line from the copy-paste. Edited that into the original comment. It doesn't really help you very far, though, since there's the Event constructor issue detailed in #96.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants