#1057 ERROR - 'NoneType' object has no attribute 'content'

2405:4802* Posted at: 4 days ago 👁17

2025-10-18 13:14:59,309 - VideoTrans - ERROR - 'NoneType' object has no attribute 'content'
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 81, in run
File "videotrans\translator\_base.py", line 99, in _run_text
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 920, 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 76, in _item_task
AttributeError: 'NoneType' object has no attribute 'content'
self.aisendsrt=False

content='# Task: Line-by-line Translation\n\nTranslate the text within the tags line by line into **{lang}**.\n\n**Core Rules:**\n1. **Strict Line-for-Line Translation**: The output must have the exact same number of lines as the input. Even if a sentence is split across lines, translate each line separately.\n2. **Preserve Untranslatable Content**: Untranslatable lines (like code, proper nouns, or paths) should be kept as-is.\n3. **Required Format**: All output must be wrapped within tags.\n\n---\n### Format Example\nThe example below illustrates the required format and rules.\n\nIgnore the specific languages in the example. Your target language is the one specified at the start of this task.\n\n#### Input:\nThis is\na long sentence.\nconfig_path\n\n#### Output:\nxml\n\n这是\n一个长句子。\nconfig_path\n\n\n---\n\n'

Window10 22H2
Ver 3.81

1 Replies

这个错误是由于使用 Gemini 翻译时返回了空内容导致的。请尝试以下解决方案:

  1. 检查 Gemini API 配置

    • 确认在"翻译设置"中正确配置了 Gemini API 密钥
    • 确保 API 密钥有效且未过期
  2. 调整翻译参数

    • 在"高级选项"中,将"同时翻译的字幕数"设置为 1
    • 取消勾选"发送完整字幕"选项
  3. 切换翻译渠道

    • 如果问题持续,建议暂时切换到其他翻译渠道,如 Google、Microsoft 或 DeepSeek
  4. 检查网络连接

    • 确保网络连接稳定,能够正常访问 Gemini API 服务

如果以上方法仍无法解决问题,请提供完整的日志文件(位于 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