首次运行时下载资源报错
Closed this issue · 4 comments
cby120 commented
nonebot version: 2.0.0rc2
nonebot-plugin-memes version: 0.3.9
driver为aiohttp和websockets
同类的petpet插件可以正常运行
Traceback (most recent call last):
File "D:\lib\Python\Python39\lib\site-packages\nonebot\drivers\_block_driver.py", line 64, in serve
await self.startup()
> File "D:\lib\Python\Python39\lib\site-packages\nonebot\drivers\_block_driver.py", line 80, in startup
await asyncio.gather(*cors)
File "D:\lib\Python\Python39\lib\site-packages\nonebot\utils.py", line 113, in _wrapper
result = await loop.run_in_executor(None, pfunc)
File "D:\lib\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "D:\lib\Python\Python39\lib\site-packages\nonebot_plugin_petpet\download.py", line 88, in _
asyncio.ensure_future(check_resources())
File "D:\lib\Python\Python39\lib\asyncio\tasks.py", line 664, in ensure_future
loop = events.get_event_loop()
File "D:\lib\Python\Python39\lib\asyncio\events.py", line 642, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'asyncio_0'.
D:\lib\Python\Python39\lib\asyncio\base_events.py:1890: RuntimeWarning: coroutine 'check_resources' was never awaited
handle = self._ready.popleft()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
补充,直接调用nonebot_plugin_memes.download.await check_resources()
可以正常下载资源,可能是asyncio.ensure_future(check_resources())
处的问题
更正,nonebot-plugin-petpet
也出现了同样的报错
更新,只有在使用ForwardDriver
时会出现上述错误,使用ReverseDriver
时不会报错
MeetWq commented
看上去是driver的问题,你的driver是怎么写的
cby120 commented
driver为aiohttp和websockets
配置文件里面写的是DRIVER=~aiohttp+~websockets
aiohttp version: 3.8.3
websockets version: 10.4
依赖安装都是在pip install nonebot2
的时候自动安装的