noneplugin / nonebot-plugin-boardgame

适用于 Nonebot2 的棋类游戏插件
44 stars 5 forks source link

开始下棋后报错playwright._impl._api_types.Error: Target page, context or browser has been closed #4

Closed EFrostBlade closed 2 years ago

EFrostBlade commented 2 years ago

开始下棋后报错 [ERROR] nonebot | Running matcher <Matcher from nonebot_plugin_chess, type=message, priority=13, temp=False> failed. Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "/usr/lib/python3.9/multiprocessing/spawn.py", line 129, in _main return self._bootstrap(parent_sentinel) File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.9/dist-packages/uvicorn/subprocess.py", line 76, in subprocess_started target(sockets=sockets) File "/usr/local/lib/python3.9/dist-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 153, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 202, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/usr/local/lib/python3.9/dist-packages/nonebot/internal/matcher.py", line 668, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/usr/local/lib/python3.9/dist-packages/nonebot/internal/matcher.py", line 635, in simple_run await handler( File "/usr/local/lib/python3.9/dist-packages/nonebot/dependencies/init.py", line 92, in call return await self.call(values) File "/usr/local/lib/python3.9/dist-packages/nonebot_pluginchess/init.py", line 71, in await handle_chess(matcher, event, argv + args) File "/usr/local/lib/python3.9/dist-packages/nonebot_plugin_chess/init.py", line 157, in handle_chess f"{game.p1} 发起了游戏 {game.name}!\n发送“落子 字母+数字”下棋,如“落子 A1”", await game.draw() File "/usr/local/lib/python3.9/dist-packages/nonebot_plugin_chess/game.py", line 217, in draw async with get_new_page() as page: File "/usr/lib/python3.9/contextlib.py", line 181, in aenter return await self.gen.anext() File "/usr/local/lib/python3.9/dist-packages/nonebot_plugin_htmlrender/browser.py", line 46, in get_new_page page = await browser.new_page(kwargs) File "/usr/local/lib/python3.9/dist-packages/playwright/async_api/_generated.py", line 11493, in new_page await self._async( File "/usr/local/lib/python3.9/dist-packages/playwright/_impl/_browser.py", line 159, in new_page context = await self.new_context(**params) File "/usr/local/lib/python3.9/dist-packages/playwright/_impl/_browser.py", line 117, in new_context channel = await self._channel.send("newContext", params) File "/usr/local/lib/python3.9/dist-packages/playwright/_impl/_connection.py", line 39, in send return await self.inner_send(method, params, False) File "/usr/local/lib/python3.9/dist-packages/playwright/_impl/_connection.py", line 63, in inner_send result = next(iter(done)).result() playwright._impl._api_types.Error: Target page, context or browser has been closed

求教大大怎么解决

EFrostBlade commented 2 years ago

缺少依赖,使用 playwright install-deps 安装即可 已解决