SRTranslator: Translation timeout (I will post the srt file)

using 2.3.0 here is the srt

INFO:root:Creating Selenium Webdriver instance
INFO:root:Going to https://www.deepl.com/translator
Loading Anime/[Judas] Horimiya (Season 1) [1080p][HEVC x265 10bit][Multi-Subs]/[Judas] Horimiya - S01E07.srt
... Translating chunk. 0 %
... Translating chunk. 24 %
... Translating chunk. 48 %
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/tbb/.local/lib/python3.10/site-packages/srtranslator/__main__.py", line 110, in <module>
    srt.translate(translator, args.src_lang, args.dest_lang)
  File "/home/tbb/.local/lib/python3.10/site-packages/srtranslator/srt_file.py", line 151, in translate
    translation = translator.translate(
  File "/home/tbb/.local/lib/python3.10/site-packages/srtranslator/translators/deepl_scrap.py", line 133, in translate
    raise TimeOutException("Translation timed out")
srtranslator.translators.base.TimeOutException: Translation timed out
Traceback (most recent call last):
  File "/home/tbb/translate.py", line 104, in <module>
    main(args)
  File "/home/tbb/translate.py", line 24, in main
    translate_srt(srt_file)
  File "/home/tbb/translate.py", line 58, in translate_srt
    subprocess.run(cmd, shell=True, check=True)
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'python -m srtranslator 'Anime/[Judas] Horimiya (Season 1) [1080p][HEVC x265 10bit][Multi-Subs]/[Judas] Horimiya - S01E07.srt' -i en -o tr -v -t deepl-scrap' returned non-zero exit status 1.```

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

No problem. But that is not the error. Actually, the first subtitle is <i></i><i></i>. This library indeed handle this cases, and convert the line to an empty string. So… when deepl translate it the translation length (number of lines) is different from source text length, that’s why it timeout : one of the checks to know if translation is done is to check the equalty of those lenghts.

A possible quick solution could be to replace empty string for a ... character. As I really don’t want to mess up deleting subtitles lines. And this library is not meant for that.

Gonna work on it. You could just add it by hand by now and translate it. Ty for catching this. 👍

Ok… thats really weird, but I’ll try in another resolutions so I can replicate. Ty for invest time finding a solution