Open nansou520 opened 1 week ago
请问这种要怎么解决
可以参考https://github.com/orgs/nonebot/discussions/13#discussioncomment-1159147 在bot.py添加
import asyncio
import platform
from uvicorn.loops import asyncio as _asyncio
from uvicorn import config
def asyncio_setup(use_subprocess=False):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
@property
def should_reload(self):
return False
if platform.system() == "Windows":
_asyncio.asyncio_setup = asyncio_setup
config.Config.should_reload = should_reload
这是官方的解决办法,但这个报错本人目前还没碰到过😓
07-06 16:22:53 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_xjie_weather, lineno=245) running complete 07-06 16:22:53 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_xjie_weather, lineno=245) failed. Traceback (most recent call last): File "", line 1, in
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 129, in _main
return self._bootstrap(parent_sentinel)
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, *self._kwargs)
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn_subprocess.py", line 78, in subprocess_started
target(sockets=sockets)
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
self.run_forever()
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
self._run_once()
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
handle._run()
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, self._args)
File "C:\Users\nanso\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
await _run_matcher(