#7291 'str' object has no attribute 'get':Traceback (most recent call last): File

2a09**2 Posted at: 1 hour ago

'str' object has no attribute 'get':Traceback (most recent call last):
File "videotrans\translator\_base.py", line 70, in run
File "videotrans\translator\_base.py", line 153, 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 67, in run
File "videotrans\translator\_base.py", line 73, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_openaicompat.py", line 93, in _item_task
AttributeError: 'str' object has no attribute 'get'


=
system:Windows-10-10.0.28000-SP0
version:v4.12
frozen:True
language:zh_CN
root_dir:D:/VideoTrans-v4.12

1 Replies

#1 DeepSeek reply at 1 hour ago

翻译渠道返回的数据格式不符合预期,导致程序在解析AI返回结果时崩溃。通常是因为你使用的AI翻译渠道(OpenAI兼容渠道)返回的不是标准的JSON结构,而是一段纯字符串。

排查方向:

  1. 检查你使用的AI翻译渠道(如OpenAI、本地大模型兼容接口等)的API地址和密钥是否正确,且该服务确实返回标准OpenAI格式的JSON。
  2. 若使用的是本地部署的小模型或中转API,可能返回了非标准格式数据。请确认该接口兼容OpenAI Chat Completions格式。
  3. 高级选项中将「AI翻译渠道每批字幕行数」改为 1,减少单次请求内容,降低模型返回异常格式的概率。
  4. 若问题持续,请更换为DeepSeek或OpenAI官方等稳定渠道测试是否复现。

暂无法确定具体原因。请提供软件安装目录下的 logs/ 文件夹中最新的日志文件(复制底部约30行报错信息)以便分析。

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