#1767 TaskCfg(cache_folder=None, target_dir='D:/Downlords/_video_out/【野中ここなのノナカの野望】#09 (2025年12月1日放送)', remove_noise=False, is

23.142* Posted at: 4 days ago 👁30

翻译字幕阶段出错:[Gemini AI] 程序内部错误:can only concatenate str (not "NoneType") to str:
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 77, in run
File "videotrans\translator\_base.py", line 135, 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 184, in run
File "videotrans\task\_translate_srt.py", line 45, in trans
File "videotrans\translator\__init__.py", line 931, in run
File "videotrans\translator\_base.py", line 80, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 137, in _item_task
TypeError: can only concatenate str (not "NoneType") to str

TaskCfg(cache_folder=None, target_dir='D:/Downlords/_video_out/【野中ここなのノナカの野望】#09 (2025年12月1日放送)', remove_noise=False, is_separate=False, detect_language=None, subtitle_language=None, source_language=None, target_language=None, source_language_code='日语语言', target_language_code='简体中文', source_sub='D:/Downlords/_video_out/【野中ここなのノナカの野望】#09 (2025年12月1日放送)/ja.srt-noautofix.srt', target_sub='D:/Downlords/_video_out/【野中ここなのノナカの野望】#09 (2025年12月1日放送)/ja.srt-noautofix.简体中文.srt', source_wav=None, source_wav_output=None, target_wav=None, target_wav_output=None, subtitles=None, novoice_mp4=None, noextname='ja.srt-noautofix', shibie_audio=None, targetdir_mp4=None, instrument=None, vocal=None, back_audio=None, background_music=None, app_mode='biaozhun', subtitle_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role=None, copysrt_rawvideo=False, clear_cache=False, translate_type=5, tts_type=None, recogn_type=None, model_name=None, split_type=0, voice_autorate=False, video_autorate=False, cuda=False, name='D:/Downlords/_video_out/【野中ここなのノナカの野望】#09 (2025年12月1日放送)/ja.srt-noautofix.srt', basename='ja.srt-noautofix.srt', ext='srt', dirname='D:/Downlords/_video_out/【野中ここなのノナカの野望】#09 (2025年12月1日放送)', shound_del_name=None, uuid='b359d50039', remove_silent_mid=False, align_sub_audio=True, enable_diariz=False, nums_diariz=0, auto_fix=True)


=
system:Windows-10-10.0.22631-SP0
version:v3.86
frozen:True
language:zh
root_dir:D:/pyvideotrans-3.86/win-pyvideotrans-v3.86

1 Replies

错误 can only concatenate str (not "NoneType") to str 表明 Gemini AI 翻译接口返回了 None 值,导致程序拼接字符串时出错。这通常由网络问题、API Key 无效或配置错误引起。

请按以下步骤排查:

  1. 检查网络与代理

    • 如果您在中国大陆,使用 Gemini 必须配置网络代理。请在主界面第5行的“网络代理”中填入正确的代理地址(格式如 http://127.0.0.1:7860)。
    • 确保代理有效且能访问 https://generativelanguage.googleapis.com
  2. 验证 API Key

    • 前往菜单栏的 工具 -> 设置
    • 在“翻译设置”中找到“Gemini AI”,检查填入的 API Key 是否正确且未过期。
    • 重要:Gemini API Key 有地域限制。如果您的 Key 是在非美国地区(如日本、欧洲)创建的,可能无法直接使用。请尝试在 Key 后面手动添加区域参数,例如将 AIzaSy... 改为 AIzaSy...&region=us
  3. 调整翻译参数

    • 在菜单栏选择 工具 -> 选项 -> 高级选项
    • 在“字幕翻译调整”区域,将“同时翻译字幕数”改为 1
    • 将“翻译后暂停时间/秒”改为 3 或更高。
    • 勾选“发送完整字幕给AI”,这有助于 Gemini 理解上下文。
  4. 测试与重试

    • 完成上述设置后,关闭软件并重新启动。
    • 在主界面勾选“清理已生成”,然后重新尝试翻译任务。

如果问题依旧,请提供 D:/pyvideotrans-3.86/win-pyvideotrans-v3.86/logs/ 目录下最新的日志文件,以便进一步分析 Gemini API 的具体返回错误。

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