#5643 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

这个错误是由于翻译渠道返回了一个空对象(None),导致程序无法读取返回数据。常见原因是 API 密钥无效、模型名称不匹配、网络代理配置错误或 API 接口地址不可用

请按以下步骤排查:

  1. 检查翻译渠道配置
    打开 菜单 → 翻译设置,找到你当前使用的翻译渠道(如 DeepSeek、OpenAI、本地模型等),确认:

    • API 地址格式正确(例如 https://api.deepseek.comhttp://127.0.0.1:8000
    • 密钥(SK)未过期且余额充足
    • 选择的模型名称在当前渠道中有效(例如 DeepSeek 应选 deepseek-chat 或官方新模型名)
  2. 检查网络代理
    如果使用了代理,请确认代理地址格式正确(如 http://127.0.0.1:7890),且代理服务正常运行。国内访问国外 API 需要代理。
  3. 临时换用传统翻译渠道测试
    将翻译渠道改为 Google翻译Microsoft翻译(免费,无需密钥)。如果能够成功翻译,说明问题出在原翻译渠道的配置或可用性上。
  4. 查看更详细的错误日志
    日志文件位于 logs/ 目录下(最新日期 .log),搜索 _openaicompat.py_item_task 附近的内容,可以找到 API 实际返回的错误信息(如 401 Unauthorizedmodel not found 等),这会更直接地指出原因。

如果以上步骤均无法解决,请提供 logs/ 目录下最新日志文件中包含 [_item_task]openaicompat 的 30 行上下文。

请查阅相关文档:

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