DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop()
Posted zhangphil
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop()相关的知识,希望对你有一定的参考价值。
python协程报错:DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop()
原因是因为是python版本过高(>=3.10),在代码中使用旧的方式获得loop:
loop = asyncio.get_event_loop()
解决方法:
新版/高版本python需要这样获取loop:
loop = asyncio.new_event_loop()
以上是关于DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop()的主要内容,如果未能解决你的问题,请参考以下文章