ask / mode

Python AsyncIO Services
Other
240 stars 55 forks source link

asyncio.get_event_loop is not supported by python 3.10 #69

Open wu-wenxiang opened 2 years ago

wu-wenxiang commented 2 years ago

Checklist

Steps to reproduce

Tell us what you did to cause something to happen.

Expected behavior

asyncio.get_event_loop is not supported by python 3.10. We should use get_running_loop & asyncio.run() instead.

Does this project be archived? If that, we have to recreate mode2 repo. :-(

Actual behavior

Not support python 3.10

Full traceback

https://docs.python.org/3/library/asyncio-eventloop.html

Get the current event loop. If there is no current event loop set in the current OS thread, the OS thread is main, and set_event_loop() has not yet been called, asyncio will create a new event loop and set it as the current one.Because this function has rather complex behavior (especially when custom event loop policies are in use), using the get_running_loop() function is preferred to get_event_loop() in coroutines and callbacks. Consider also using the asyncio.run() function instead of using lower level functions to manually create and close an event loop. Deprecated since version 3.10: Deprecation warning is emitted if there is no running event loop. In future Python releases, this function will be an alias of get_running_loop().

get_running_loop is new in version 3.7

python 3.6 is out of support at the end of 2021.

Versions

lqhuang commented 2 years ago

@wu-wenxiang You can try my forked release mode-ng which has already supported Python 3.10. It won't be better if you could also give me some feed-backs. Thanks!

wu-wenxiang commented 2 years ago

Thanks~