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

122.238**0 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\connection.py", line 101, in handle_request
File "httpcore\_sync\http11.py", line 143, in handle_request
File "httpcore\_sync\http11.py", line 93, in handle_request
File "httpcore\_sync\http11.py", line 151, in _send_request_headers
File "contextlib.py", line 153, in exit
File "httpcore\_exceptions.py", line 14, in map_exceptions
httpcore.LocalProtocolError: Illegal header value b'Bearer \nsk-DNU1k9BeORZI677O5fMoPWFCzLrxMYLM03hjWIHZvVOiujVv'

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 913, in send
File "httpx\_client.py", line 941, in _send_handling_auth
File "httpx\_client.py", line 978, in _send_handling_redirects
File "httpx\_client.py", line 1013, 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.LocalProtocolError: Illegal header value b'Bearer \nsk-DNU1k9BeORZI677O5fMoPWFCzLrxMYLM03hjWIHZvVOiujVv'

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 907, in run
File "videotrans\translator\_base.py", line 83, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_localllm.py", line 54, in _item_task
File "openai\_utils\_utils.py", line 286, in wrapper
File "openai\resources\chat\completions\completions.py", line 1156, 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.19045-SP0
version:v3.84
frozen:True
language:zh
root_dir:E:/Pyvideotrans

1 Replies

#1 DeepSeek reply at 2 hours ago

这是 API Key 中包含了换行符导致的。报错 Illegal header value b'Bearer \nsk-...' 表明请求头中的 Bearer Token 被插入了 \n 换行,常见的粘贴或复制错误。

解决方法:

  1. 打开软件 菜单 → 翻译设置 → 对应 AI/OpenAI兼容渠道,删除当前填写的 API Key。
  2. 重新粘贴你的 API Key,确保只包含密钥字符串本身,前后不要有任何空格、换行或多余字符。
  3. 建议手动输入末尾几个字符以确认无隐藏换行。
  4. 保存后重新执行任务。

版本提示: 你当前使用的是 v3.84,属于较旧版本。建议先升级到最新版 v4.11,此问题在后续版本中也有相应兼容优化。可从官网 下载软件 获取最新完整包或补丁包覆盖。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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

Related resource