#5642 AttributeError: 'NoneType' object has no attribute 'get'

123.110* Posted at: 1 day ago

程序内部错误:'NoneType' object has no attribute 'get':Traceback (most recent call last):
File "videotrans\translator\_base.py", line 69, in run
File "videotrans\translator\_base.py", line 143, in _run_srt
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 421, in exc_check
tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\_runner.py", line 63, in run
File "videotrans\translator\_base.py", line 72, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_openaicompat.py", line 79, in _item_task
AttributeError: 'NoneType' object has no attribute 'get'


=
system:Windows-10-10.0.19043-SP0
version:v4.04
frozen:True
language:zh
root_dir:D:/pyvideotrans4040704

1 Replies

此错误是因为AI翻译渠道(如OpenAI、DeepSeek等)返回了异常数据(空响应或错误信息),导致解析choices字段时失败。

可能原因及解决办法:

  1. API密钥无效或余额不足 → 检查密钥是否正确,账户余额是否充足。
  2. API地址填写错误 → 若使用兼容AI/本地模型,地址不可为0.0.0.0,应改为127.0.0.1
  3. 网络连接问题 → 若需代理,确保网络代理设置正确(格式如http://127.0.0.1:7890);若无需代理,请清空代理文本框。
  4. 模型名称不支持或超长上下文 → 检查所选模型是否支持当前请求,尝试降低AI翻译渠道每批字幕行数或关闭发送完整字幕

快速验证: 临时切换到免费的Google翻译或微软翻译渠道,若能正常翻译,则问题出在AI渠道配置上。

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: ko-fi.com/jianchang512

Related resource