Skip to content

求助 #703

@qian2023qian

Description

@qian2023qian

检查项

  • 我确认此问题在所有分支的最新版本中依旧存在
  • 我确认在 Issues 列表中并无其他人已经提出过与此问题相同或相似的问题
  • 我使用了 Docker

使用的分支

main

具体版本号

0.6.1

遇到的问题

NoneBot框架处理图片消息时出现了问题,尝试下载图片时出现了:代码试图从本地路径读取一张图片文件,但该路径下文件不存在 ,SSL握手失败 的错误

报错信息

(MaiBotEnv) (base) root@qianqiannas:/volume1/homes/qianqian/maimbotv7/nonebot-maibot-adapter# nb run --reload
Started reloader with process [20262].
04-09 01:28:10 [SUCCESS] nonebot | NoneBot is initializing...
04-09 01:28:10 [INFO] nonebot | Current Env: dev
04-09 01:28:10 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi+~websockets', 'host': IPv4Address('127.0.0.1'), 'port': 18002, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': set(), 'nickname': set(), 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'environment': 'dev', 'onebot_ws_urls': ['ws://127.0.0.1:8095']}
04-09 01:28:10 [DEBUG] nonebot | Succeeded to load adapter "OneBot V11"
04-09 01:28:11 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_maibot_adapters" from "src.plugins.nonebot_plugin_maibot_adapters"
04-09 01:28:11 [SUCCESS] nonebot | Running NoneBot...
04-09 01:28:11 [SUCCESS] nonebot | Loaded adapters: OneBot V11
04-09 01:28:11 [INFO] uvicorn | Started server process [20262]
04-09 01:28:11 [INFO] uvicorn | Waiting for application startup.
04-09 01:28:11 [INFO] uvicorn | Application startup complete.
04-09 01:28:11 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:18002 (Press CTRL+C to quit)
04-09 01:28:11 [DEBUG] nonebot | OneBot V11 | WebSocket Connection to ws://127.0.0.1:8095/ established
04-09 01:28:11 [INFO] nonebot | OneBot V11 | Bot 3568784386 connected
04-09 01:30:53 [SUCCESS] nonebot | OneBot V11 3568784386 | [notice.notify.input_status]: {'time': 1744133453, 'self_id': 3568784386, 'post_type': 'notice', 'notice_type': 'notify', 'sub_type': 'input_status', 'user_id': 3472492003, 'group_id': 0, 'status_text': '', 'event_type': 2}
04-09 01:30:53 [DEBUG] nonebot | Checking for matchers in priority 1...
04-09 01:30:53 [INFO] nonebot | Event will be handled by Matcher(type='notice', module=src.plugins.nonebot_plugin_maibot_adapters, lineno=24)
04-09 01:30:53 [DEBUG] nonebot | Running Matcher(type='notice', module=src.plugins.nonebot_plugin_maibot_adapters, lineno=24)
04-09 01:30:53 [DEBUG] nonebot | Running handler Dependent(call=_)
04-09 01:30:53 [DEBUG] nonebot_plugin_maibot_adapters | 收到通知:[notice.notify.input_status]: {'time': 1744133453, 'self_id': 3568784386, 'post_type': 'notice', 'notice_type': 'notify', 'sub_type': 'input_status', 'user_id': 3472492003, 'group_id': 0, 'status_text': '', 'event_type': 2}
04-09 01:30:53 [INFO] nonebot | Matcher(type='notice', module=src.plugins.nonebot_plugin_maibot_adapters, lineno=24) running complete
04-09 01:30:53 [DEBUG] nonebot | Checking for matchers in priority 5...
04-09 01:30:53 [DEBUG] nonebot | Checking for matchers completed
04-09 03:51:08 [SUCCESS] nonebot | OneBot V11 3568784386 | [message.private.friend]: Message 1534326913 from 3472492003 '[image:summary=,file=96618EF05771DC4EBD0B1202BC03B742.jpg,sub_type=0,url=https://multimedia.nt.qq.com.cn/download?appid=1406&fileid=EhR75k2D...,file_size=218416]'
04-09 03:51:08 [DEBUG] nonebot | Checking for matchers in priority 1...
04-09 03:51:08 [DEBUG] nonebot | Checking for matchers in priority 5...
04-09 03:51:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.nonebot_plugin_maibot_adapters, lineno=23)
04-09 03:51:08 [DEBUG] nonebot | Running Matcher(type='message', module=src.plugins.nonebot_plugin_maibot_adapters, lineno=23)
04-09 03:51:08 [DEBUG] nonebot | Running handler Dependent(call=_)
04-09 03:51:08 [DEBUG] nonebot | OneBot V11 | Calling API get_stranger_info
04-09 03:51:08 [DEBUG] nonebot | OneBot V11 | Calling API get_image
04-09 03:51:08 [INFO] nonebot_plugin_maibot_adapters | 本地文件不存在,切换url下载
04-09 03:51:10 [ERROR] nonebot_plugin_maibot_adapters | 图片下载失败: Cannot connect to host multimedia.nt.qq.com.cn:443 ssl:default [[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1010)]
04-09 03:51:10 [INFO] nonebot | Matcher(type='message', module=src.plugins.nonebot_plugin_maibot_adapters, lineno=23) running complete
04-09 03:51:10 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.nonebot_plugin_maibot_adapters, lineno=23) failed.
Traceback (most recent call last):
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/connector.py", line 1122, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs, sock=sock)
  File "uvloop/loop.pyx", line 2088, in create_connection
    raise
  File "uvloop/loop.pyx", line 2083, in uvloop.loop.Loop.create_connection
    await ssl_waiter
  File "uvloop/sslproto.pyx", line 517, in uvloop.loop.SSLProtocol._on_handshake_complete
    raise handshake_exc
  File "uvloop/sslproto.pyx", line 499, in uvloop.loop.SSLProtocol._do_handshake
    self._sslobj.do_handshake()
  File "/root/miniconda3/lib/python3.12/ssl.py", line 916, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1010)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/__init__.py", line 337, in run
    get_driver().run(*args, **kwargs)
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/drivers/fastapi.py", line 187, in run
    uvicorn.run(
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/uvicorn/main.py", line 579, in run
    server.run()
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/uvicorn/server.py", line 66, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/root/miniconda3/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
  File "/root/miniconda3/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/utils.py", line 254, in run_coro_with_shield
    return await coro
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/message.py", line 506, in check_and_run_matcher
    await _run_matcher(
> File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/message.py", line 458, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/internal/matcher/matcher.py", line 926, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/internal/matcher/matcher.py", line 863, in simple_run
    await handler(
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/volume1/homes/qianqian/maimbotv7/nonebot-maibot-adapter/src/plugins/nonebot_plugin_maibot_adapters/__init__.py", line 37, in _
    await chat_bot.handle_image_message(event, bot)
  File "/volume1/homes/qianqian/maimbotv7/nonebot-maibot-adapter/src/plugins/nonebot_plugin_maibot_adapters/bot.py", line 306, in handle_image_message
    base64_str = await download_image_url(image_url)
  File "/volume1/homes/qianqian/maimbotv7/nonebot-maibot-adapter/src/plugins/nonebot_plugin_maibot_adapters/util.py", line 118, in download_image_url
    async with session.get(url) as resp:
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/client.py", line 1425, in __aenter__
    self._resp: _RetType = await self._coro
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/client.py", line 703, in _request
    conn = await self._connector.connect(
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/connector.py", line 548, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/connector.py", line 1056, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/connector.py", line 1400, in _create_direct_connection
    raise last_exc
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/connector.py", line 1369, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/volume1/homes/qianqian/maimbotv7/MaiBotEnv/lib/python3.12/site-packages/aiohttp/connector.py", line 1126, in _wrap_create_connection
    raise ClientConnectorSSLError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host multimedia.nt.qq.com.cn:443 ssl:default [[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1010)]
04-09 03:51:10 [DEBUG] nonebot | Stop event propagation
04-09 03:51:10 [DEBUG] nonebot | Checking for matchers completed

如何重现此问题?

向麦麦发送图片

可能造成问题的原因

No response

系统环境

Linux qianqiannas 5.10.55+ #69057 SMP Fri Jan 12 17:02:57 CST 2024 x86_64 GNU/Linux synology_epyc7002_sa6400

Python 版本

python12.8

补充信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions