nonebot / nonebot2

跨平台 Python 异步聊天机器人框架 / Asynchronous multi-platform chatbot framework written in Python
https://nonebot.dev
MIT License
5.97k stars 555 forks source link

Bug: 启动时出现NotImplementedError #2059

Closed RaTaiHok closed 1 year ago

RaTaiHok commented 1 year ago

操作系统

Windows

Python 版本

3.9.7

NoneBot 版本

2.0.0rc4

适配器

OB V11 2.2.2

协议端

gocq http 1.0.0 rc5

描述问题

我不知道是插件的问题还是什么问题 在我离开一段时间后便有了这个报错 在尝试一个一个卸载插件后无任何改变

复现步骤

1.加载插件后报错

期望的结果

No response

截图或日志

05-26 22:31:17 [SUCCESS] nonebot | NoneBot is initializing...
05-26 22:31:17 [INFO] nonebot | Current Env: dev
05-26 22:31:17 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 55414, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': {'1186848360'}, 'nickname': {''}, 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'fastapi_reload': True, 'environment': 'dev'}
05-26 22:31:17 [DEBUG] nonebot | Succeeded to load adapter "OneBot V11"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_ddcheck"
05-26 22:31:18 [INFO] nonebot-plugin-ncm | 检测到缓存,自动加载用户
05-26 22:31:18 [SUCCESS] nonebot-plugin-ncm | 欢迎您网易云用户:RTH_OwO [479972885]
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "nonebot-plugin-ncm"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_remake"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_wordle"
05-26 22:31:18 [SUCCESS] nonebot | Succeeded to load plugin "pstc" from "mihobot.plugins.pstc"
05-26 22:31:19 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_sleep"
05-26 22:31:19 [SUCCESS] nonebot | Succeeded to load plugin "everydayluck" from "mihobot.plugins.everydayluck"
05-26 22:31:19 [SUCCESS] nonebot | Running NoneBot...
05-26 22:31:19 [DEBUG] nonebot | Loaded adapters: OneBot V11
05-26 22:31:19 [INFO] uvicorn | Will watch for changes in these directories: ['C:\\Users\\Administrator\\Desktop\\nonebot2-2.0.0rc4\\MihoBot']
05-26 22:31:19 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:55414 (Press CTRL+C to quit)
05-26 22:31:19 [INFO] uvicorn | Started reloader process [20096] using StatReload
05-26 22:31:19 [SUCCESS] nonebot | NoneBot is initializing...
05-26 22:31:19 [INFO] nonebot | Current Env: dev
05-26 22:31:19 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 55414, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': {'1186848360'}, 'nickname': {''}, 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'fastapi_reload': True, 'environment': 'dev'}
05-26 22:31:19 [DEBUG] nonebot | Succeeded to load adapter "OneBot V11"
05-26 22:31:19 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo"
05-26 22:31:20 [INFO] nonebot-plugin-ncm | 检测到缓存,自动加载用户
05-26 22:31:20 [SUCCESS] nonebot-plugin-ncm | 欢迎您网易云用户:RTH_OwO [479972885]
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot-plugin-ncm"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_ddcheck"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "pstc" from "mihobot.plugins.pstc"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_remake"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "everydayluck" from "mihobot.plugins.everydayluck"
05-26 22:31:20 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_sleep"
05-26 22:31:21 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_wordle"
05-26 22:31:21 [INFO] uvicorn | Started server process [22356]
05-26 22:31:21 [INFO] uvicorn | Waiting for application startup.
05-26 22:31:21 [INFO] nonebot_plugin_apscheduler | Scheduler Started
Task exception was never retrieved
future: <Task finished name='Task-3' coro=<Connection.run() done, defined at C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\_impl\_connection.py:258> exception=NotImplementedError()>
Traceback (most recent call last):
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\_impl\_connection.py", line 265, in run
    await self._transport.connect()
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\_impl\_transport.py", line 127, in connect
    raise exc
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\_impl\_transport.py", line 116, in connect
    self._proc = await asyncio.create_subprocess_exec(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\subprocess.py", line 236, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1661, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 493, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError
05-26 22:31:21 [ERROR] uvicorn | Traceback (most recent call last):
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\starlette\routing.py", line 677, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 181, in __aenter__
    return await self.gen.__anext__()
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\nonebot\drivers\fastapi.py", line 165, in _lifespan_manager
    await self._lifespan.startup()
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\nonebot\drivers\_lifespan.py", line 35, in startup
    await self._run_lifespan_func(self._startup_funcs)
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\nonebot\drivers\_lifespan.py", line 29, in _run_lifespan_func
    await cast(ASYNC_LIFESPAN_FUNC, func)()
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\nonebot_plugin_htmlrender\__init__.py", line 25, in init
    browser = await get_browser(**kwargs)
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\nonebot_plugin_htmlrender\browser.py", line 60, in get_browser
    return _browser if _browser and _browser.is_connected() else await init(**kwargs)
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\nonebot_plugin_htmlrender\browser.py", line 36, in init
    _playwright = await async_playwright().start()
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\async_api\_context_manager.py", line 51, in start
    return await self.__aenter__()
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\async_api\_context_manager.py", line 46, in __aenter__
    playwright = AsyncPlaywright(next(iter(done)).result())
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\_impl\_connection.py", line 265, in run
    await self._transport.connect()
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\_impl\_transport.py", line 127, in connect
    raise exc
  File "C:\Users\Administrator\.local\pipx\venvs\nb-cli\lib\site-packages\playwright\_impl\_transport.py", line 116, in connect
    self._proc = await asyncio.create_subprocess_exec(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\subprocess.py", line 236, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1661, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 493, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError

05-26 22:31:21 [ERROR] uvicorn | Application startup failed. Exiting.
StarHeartHunt commented 1 year ago

与 #376 重复

synodriver commented 1 year ago

这个是因为window上的asyncio的selectoreventloop没有实现子进程传输系列方法,偏偏uvicorn默认用这个loop,换linux可以解决