#2047 ValueError: invalid literal for int() with base 10: ''

158.247* Posted at: 7 hours ago 👁4

无效的值或参数:invalid literal for int() with base 10: '':Traceback (most recent call last):
File "videotrans\translator\_base.py", line 78, in run
File "videotrans\translator\_base.py", line 137, 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\__init__.py", line 932, in run
File "videotrans\translator\_base.py", line 81, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 74, in _item_task
ValueError: invalid literal for int() with base 10: ''


=
system:Windows-10-10.0.19045-SP0
version:v3.90
frozen:True
language:zh
root_dir:D:/Program Files/win-videotrans-v3.67-tiny

1 Replies

这个错误表明在使用 Gemini 翻译时,程序尝试将一个空字符串 '' 转换为整数,但失败了。这通常是由于 Gemini API 返回了非预期的响应格式,或者翻译设置中的某些参数为空。

请按以下步骤排查:

  1. 检查 Gemini API 密钥:确保在“翻译设置”中填写的 Gemini API 密钥正确且有效。
  2. 检查翻译模型:在“翻译设置”的 Gemini 配置中,确认选择的模型名称正确(例如 gemini-1.5-pro)。
  3. 调整翻译批次:在菜单栏选择 工具 -> 选项 -> 高级选项,在“字幕翻译调整”区域,将“每批字幕行数”改为 1,然后重试。这有助于定位具体是哪一行字幕导致了问题。
  4. 检查字幕文件:如果问题出现在“工具箱 -> 批量翻译 SRT”功能中,请检查你的 SRT 字幕文件格式是否正确,特别是时间轴行(如 00:00:01,000 --> 00:00:03,000)后面是否紧跟着有效的字幕文本,没有空行或格式错误。
  5. 切换翻译渠道:作为临时解决方案,可以尝试更换其他翻译渠道(如 Google、DeepSeek 等)来确认是否是 Gemini 接口的临时问题。

如果以上步骤无法解决,请提供 D:/Program Files/win-videotrans-v3.67-tiny/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