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

183.161* Posted at: 1 day ago

invalid literal for int() with base 10: '':Traceback (most recent call last):
File "videotrans\translator\_base.py", line 68, in run
File "videotrans\translator\_base.py", line 142, 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 860, in run
File "videotrans\translator\_base.py", line 71, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_openaicompat.py", line 59, in _item_task
ValueError: invalid literal for int() with base 10: ''


=
system:Windows-10-10.0.26100-SP0
version:v4.03
frozen:True
language:zh
root_dir:D:/BaiduNetdiskDownload/001翻译并配音(windows系统)

1 Replies

该错误是因为翻译渠道调用时,API 返回的响应中某个预期为整数的字段(如 created 等)为空字符串,导致 int() 转换失败。通常出现在使用“兼容 AI/本地模型”或其他基于 OpenAI 格式的第三方 API 时,返回的 JSON 结构不符合标准。

排查步骤:

  1. 检查翻译渠道配置:进入 菜单 - 翻译设置,确认你当前使用的翻译渠道是否正确填写了 API 地址和密钥。如果使用的是一键部署的本地大模型或中转 API,请确保其接口完全兼容 OpenAI 的 /v1/chat/completions 格式,并且返回的 created 字段是非空的整数。
  2. 验证 API 响应:你可以用测试工具(如 Postman 或 curl)向你的 API 地址发送一个简单的请求,检查返回的 JSON 中是否包含 createdchoices[0].finish_reason 等字段,且类型为数字或正常字符串。
  3. 更换翻译渠道:如果无法确认 API 的兼容性,建议临时切换到官方提供的翻译渠道,例如 DeepSeekGoogle 翻译 等,以排除软件本身的问题。
  4. 检查网络/代理:如果使用了代理,请确保代理地址正确且稳定,避免响应被截断。

如果以上仍无法解决,请提供 logs/ 文件夹中完整的日志文件(至少包含报错前后约30行),以便进一步分析。

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. Dondate: ko-fi.com/jianchang512

Related resource

Similar issues already exist