debug日志:08-08 01:12:47 [SUCCESS] nonebot | OneBot V11 | [message.group.normal]: Message -2147446475 from @[群:] '开始学习'
08-08 01:12:47 [DEBUG] nonebot | Running PreProcessors...
08-08 01:12:47 [DEBUG] nonebot | Checking for matchers in priority 1...
08-08 01:12:47 [DEBUG] nonebot | Checking for matchers in priority 50...
08-08 01:12:48 [INFO] nonebot | Event will be handled by Matcher(type='message', module=XXQG.utils.handle, lineno=25)
08-08 01:12:48 [DEBUG] nonebot | Running Matcher(type='message', module=XXQG.utils.handle, lineno=25)
08-08 01:12:48 [DEBUG] nonebot | Running handler Dependent(call=startStudy)
08-08 01:12:48 [DEBUG] nonebot | OneBot V11 | Calling API send_msg
08-08 01:12:49 [INFO] nonebot | Matcher(type='message', module=XXQG.utils.handle, lineno=25) running complete
08-08 01:12:49 [ERROR] nonebot | Running Matcher(type='message', module=XXQG.utils.handle, lineno=25) failed.
Traceback (most recent call last):
File "", line 21, in
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/init.py", line 335, in run
get_driver().run(*args, **kwargs)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
uvicorn.run(
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
server.run()
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/local/python-3.10.13/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
await _run_matcher(
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
await handler(
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/dependencies/init.py", line 94, in call
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/XXQG/utils/handle.py", line 212, in startStudy
status = await startTask(user.uid)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/XXQG/utils/activity.py", line 643, in startTask
browser = await p.chromium.launch_persistent_context(
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 14377, in launch_persistent_context
await self._impl_obj.launch_persistent_context(
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/playwright/_impl/_browser_type.py", line 157, in launch_persistent_context
from_channel(await self._channel.send("launchPersistentContext", params)),
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 59, in send
return await self._connection.wrap_api_call(
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 514, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TargetClosedError: BrowserType.launch_persistent_context: Target page, context or browser has been closed
Browser logs:
╔════════════════════════════════════════════════════════════════════════════════════════════════╗
║ Looks like you launched a headed browser without having a XServer running. ║
║ Set either 'headless: true' or use 'xvfb-run ' before running Playwright. ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════════════════════════════════════════╝
Call log:
环境为Ubuntu24.4,安装有gnome图形UI,py3.10.14 转自AI: 根据您提供的日志信息,您在尝试使用Playwright启动Chromium浏览器实例时遇到了问题。错误信息显示,Playwright尝试启动一个有头(headed)的浏览器实例,但没有运行X服务器。在Ubuntu 22.04 LTS上,Chromium等浏览器通常需要X服务器来显示图形界面。由于您的环境中没有运行X服务器,浏览器启动失败,导致TargetClosedError。
debug日志:08-08 01:12:47 [SUCCESS] nonebot | OneBot V11 | [message.group.normal]: Message -2147446475 from @[群:] '开始学习' 08-08 01:12:47 [DEBUG] nonebot | Running PreProcessors... 08-08 01:12:47 [DEBUG] nonebot | Checking for matchers in priority 1... 08-08 01:12:47 [DEBUG] nonebot | Checking for matchers in priority 50... 08-08 01:12:48 [INFO] nonebot | Event will be handled by Matcher(type='message', module=XXQG.utils.handle, lineno=25) 08-08 01:12:48 [DEBUG] nonebot | Running Matcher(type='message', module=XXQG.utils.handle, lineno=25) 08-08 01:12:48 [DEBUG] nonebot | Running handler Dependent(call=startStudy) 08-08 01:12:48 [DEBUG] nonebot | OneBot V11 | Calling API send_msg 08-08 01:12:49 [INFO] nonebot | Matcher(type='message', module=XXQG.utils.handle, lineno=25) running complete 08-08 01:12:49 [ERROR] nonebot | Running Matcher(type='message', module=XXQG.utils.handle, lineno=25) failed. Traceback (most recent call last): File "", line 21, in
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/init.py", line 335, in run
get_driver().run(*args, **kwargs)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
uvicorn.run(
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
server.run()
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/local/python-3.10.13/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/python-3.10.13/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
await _run_matcher(
╔════════════════════════════════════════════════════════════════════════════════════════════════╗ ║ Looks like you launched a headed browser without having a XServer running. ║ ║ Set either 'headless: true' or use 'xvfb-run' before running Playwright. ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════════════════════════════════════════╝
Call log: