#1315 json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

2804:7f0* Posted at: 9 hours ago 👁8

翻译字幕阶段出错:[Gemini AI] 无效的值或参数:Expecting property name enclosed in double quotes: line 1 column 2 (char 1):
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 80, 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\task\job.py", line 146, in run
File "videotrans\task\_translate_srt.py", line 45, in trans
File "videotrans\translator\__init__.py", line 936, in run
File "videotrans\translator\_base.py", line 83, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 103, in _item_task
File "google\genai\models.py", line 5783, in generate_content_stream
File "google\genai\models.py", line 4666, in _generate_content_stream
File "google\genai\_api_client.py", line 775, in request_streamed
File "google\genai\_api_client.py", line 237, in segments
File "json\__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 353, in raw_decode
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)


=
system:Windows-10-10.0.26200-SP0
version:v3.83
frozen:True
language:zh
root_dir:D:/win-videotrans-v3.83_20251103_013844

1 Replies

这个错误是由于 Gemini AI 返回的响应格式不符合 JSON 规范导致的。问题出现在翻译字幕阶段,Gemini API 返回的数据无法被正确解析为 JSON。

解决方案:

  1. 检查 Gemini API 密钥:请确认您在翻译设置中输入的 Gemini API 密钥是正确的且未过期。
  2. 调整翻译参数

    • 在菜单栏选择 工具/选项 → 高级选项
    • 在"翻译调整"区域:

      • 将"同时翻译的字幕数"设置为 1
      • 取消勾选"发送完整字幕"
  3. 尝试其他翻译渠道

    • 暂时切换到 Google、Microsoft 或其他翻译渠道完成当前任务
    • 稍后再尝试使用 Gemini
  4. 检查网络连接:确保网络连接稳定,特别是如果您在使用代理。

如果以上方法仍无法解决问题,请提供 videotrans/logs/ 目录下的最新日志文件以便进一步分析。

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.

Donate: https://ko-fi.com/jianchang512

Trending Questions