#6167 网络连接失败:Traceback (most recent call last): File

104.28* Posted at: 2 hours ago

网络连接失败:Traceback (most recent call last):
File "httpx\_transports\default.py", line 101, in map_httpcore_exceptions
File "httpx\_transports\default.py", line 250, in handle_request
File "httpcore\_sync\connection_pool.py", line 216, in handle_request
File "httpcore\_sync\connection_pool.py", line 196, in handle_request
File "httpcore\_sync\http_proxy.py", line 289, in handle_request
File "httpcore\_sync\connection.py", line 99, in handle_request
File "httpcore\_sync\connection.py", line 76, in handle_request
File "httpcore\_sync\connection.py", line 122, in _connect
File "httpcore\_backends\sync.py", line 205, in connect_tcp
File "contextlib.py", line 153, in exit
File "httpcore\_exceptions.py", line 14, in map_exceptions
httpcore.ConnectError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

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

Traceback (most recent call last):
File "openai\_base_client.py", line 982, in request
File "httpx\_client.py", line 914, in send
File "httpx\_client.py", line 942, in _send_handling_auth
File "httpx\_client.py", line 979, in _send_handling_redirects
File "httpx\_client.py", line 1014, in _send_single_request
File "httpx\_transports\default.py", line 249, in handle_request
File "contextlib.py", line 153, in exit
File "httpx\_transports\default.py", line 118, in map_httpcore_exceptions
httpx.ConnectError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

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

Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\__init__.py", line 970, in run
File "videotrans\translator\_base.py", line 105, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_openrouter.py", line 58, in _item_task
File "openai\_utils\_utils.py", line 286, in wrapper
File "openai\resources\chat\completions\completions.py", line 1192, in create
File "openai\_base_client.py", line 1259, in post
File "openai\_base_client.py", line 1014, in request
openai.APIConnectionError: Connection error.


=
system:Windows-10-10.0.22631-SP0
version:v3.96
frozen:True
language:zh
root_dir:D:/pyVideoTrans/V3.96

1 Replies

这是由API 连接被目标计算机拒绝导致的网络错误,软件在尝试向 OpenRouter.ai 或兼容 OpenAI 的 API 地址发送请求时,对方服务器主动拒绝了连接。

常见原因:

  1. API 地址或端口填写错误(例如填了 0.0.0.0 或错误的端口号);
  2. 本地服务未启动(如果你使用了本地部署的模型如 GPT-SoVITS、ChatTTS 等,API 服务未运行);
  3. 网络代理配置不当(代理地址无效或代理服务器未运行);
  4. 防火墙/杀毒软件拦截软件的网络请求;
  5. API 密钥或服务被平台封禁(较少见)。

按以下步骤排查:

  1. 打开软件菜单 → 翻译设置 → 找到你使用的翻译渠道(根据报错很可能是 OpenRouter兼容AI/本地模型)。
  2. 检查 API 地址 是否填写正确:

    • 如果是线上服务,确保地址格式类似 https://api.openrouter.ai/v1 且末尾无多余斜杠。
    • 如果是本地服务(例如 GPT-SoVITS),地址应为 http://127.0.0.1:9880不要写成 0.0.0.0,软件会自动检测并提示。
  3. 确认服务是否已启动(仅本地部署):打开命令行或服务管理界面,确认对应 API 服务正在运行。
  4. 检查代理设置

    • 如果不需要代理,请将软件主界面右下角的 网络代理 文本框彻底清空(不要留空格)并保存。
    • 如果需要代理,格式必须为 http://127.0.0.1:端口号socks5://127.0.0.1:端口号,并确保代理软件已开启。
  5. 暂时关闭防火墙/杀毒软件(如 360、火绒、Windows Defender),然后重试。
  6. 如果以上均无效,请在软件 videotrans/params.json 文件中检查该渠道的 API 地址配置是否有多余字符或排版错误。

请查阅相关文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Dondate via PayPal

Related resource