#7062 Error during TTS dubbing stage [gTTS(Free)] AssertionError: No text to send to TTS APITraceback (most recent call last):

42.116**0 Posted at: 3 hours ago

Error during TTS dubbing stage [gTTS(Free)] AssertionError: No text to send to TTS API
Traceback (most recent call last):

File "videotrans\tts\_base.py", line 103, in run

File "videotrans\tts\_gtts.py", line 26, in _exec

File "videotrans\tts\_base.py", line 162, in _local_mul_thread

File "videotrans\tts\_gtts.py", line 46, in _item_task

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 35, in run

File "videotrans\task\job.py", line 156, in process_task

File "videotrans\task\dubbing.py", line 56, in dubbing

File "videotrans\task\dubbing.py", line 209, in _tts

File "videotrans\tts\__init__.py", line 233, in run

File "videotrans\tts\_base.py", line 105, in run

File "tenacity\__init__.py", line 480, in call

File "videotrans\tts\_gtts.py", line 42, in _run

File "gtts\tts.py", line 335, in save

File "gtts\tts.py", line 316, in write_to_fp

File "gtts\tts.py", line 263, in stream

File "gtts\tts.py", line 210, in _prepare_requests

AssertionError: No text to send to TTS API
[DubbingSrt]语音合成: self.out_ext='wav',self.is_multi_role=False
[TaskCfgTTS]
原始输入文件名: C:/Users/Admin/Videos/VideoTrans/Tái Sinh 7 Ngày Trước Tận Thế - Cô Ấy Thức Tỉnh Dị Năng Không Gian/vi_all_final - Copy.srt,
输出结果保存到文件夹: C:/Users/Admin/Videos/VideoTrans/Tái Sinh 7 Ngày Trước Tận Thế - Cô Ấy Thức Tỉnh Dị Năng Không Gian,
临时文件夹: D:/A-win-pyvideotrans-v4.11/tmp/16164/f2f282bb1b
已启用CUDA加速
TTS Service:gTTS(Free), 角色:gtts, 配音语言:vi
音量:+20%, 语速:+4%, 已选 音频加速


=
system:Windows-10-10.0.28000-SP0
version:v4.11
frozen:True
language:en
root_dir:D:/A-win-pyvideotrans-v4.11

1 Replies

#1 DeepSeek reply at 3 hours ago

The error AssertionError: No text to send to TTS API is raised by the gTTS library because one or more subtitle entries in your SRT file are empty—they have timecodes but no text content (or only whitespace/special characters). gTTS asserts that a non-empty text string is passed to it, so it fails.

Fix steps:

  1. Open C:/Users/Admin/Videos/VideoTrans/Tái Sinh 7 Ngày Trước Tận Thế - Cô Ấy Thức Tỉnh Dị Năng Không Gian/vi_all_final - Copy.srt in a text editor (e.g., Notepad++).
  2. Look for subtitle entries where the line between the timecode and the next index is empty—for example:

    42
    00:00:01,000 --> 00:00:02,000
    

    (i.e., nothing after the timecode before the blank line).

  3. Delete those empty entries, or fill in the missing text. Also check for lines containing only punctuation or numbers—gTTS will also reject those.
  4. Save the file and retry the task.

Additional notes:

  • If you prefer not to manually edit the file, enable 清理已生成 in the main interface before re-running the translation. This will regenerate the subtitle file from scratch, but it also deletes the previous .srt file, so only use this if you're okay losing manual edits.
  • The SRT file must strictly follow the SRT specification. Since your filename contains - Copy, it may have been edited externally—ensure no stray formatting was introduced.
  • Consider switching to the default Edge-TTS(免费) channel instead of gTTS, as it is generally more robust and is the recommended default for most languages.

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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 via ko-fi.com

Related resource