You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import os
from srtranslator import SrtFile
#from srtranslator.translators.deepl_api import DeeplApi
#from srtranslator.translators.deepl_scrap import DeeplTranslator
from srtranslator.translators.translatepy import TranslatePy
translator = TranslatePy()
filepath = "/home/alucard/Downloads/film.srt"
srt = SrtFile(filepath)
srt.translate(translator, "nl", "hu")
# Making the result subtitles prettier
srt.wrap_lines()
srt.save(f"{os.path.splitext(filepath)[0]}_translated.srt")
result
[alucard@arch ~/Downloads]$ python translate.py
Loading /home/alucard/Downloads/film.srt
... Translating chunk. 0 %
Traceback (most recent call last):
File "/home/alucard/Downloads/translate.py", line 9, in <module>
srt.translate(translator, "nl", "hu")
File "/home/alucard/.local/lib/python3.11/site-packages/srtranslator/srt_file.py", line 154, in translate
translation = translator.translate(
^^^^^^^^^^^^^^^^^^^^^
File "/home/alucard/.local/lib/python3.11/site-packages/srtranslator/translators/translatepy.py", line 14, in translate
result = self.translator.translate(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alucard/.local/lib/python3.11/site-packages/translatepy/translate.py", line 135, in translate
raise NoResult("No service has returned a valid result")
translatepy.exceptions.NoResult: No service has returned a valid result
Does not work with other translators...
Arch Linux
The text was updated successfully, but these errors were encountered:
This is an issue with TranslatePy, it wasn't able to fullfill the translation request. I can't really do much to help. This is a helper to translate .srt files, not really to actually translate it, tho has multiple built-in providers, try another one, probably the most used is DeeplTranslator (not the api, the selinum based).
It doesn't work for me
script
result
Does not work with other translators...
Arch Linux
The text was updated successfully, but these errors were encountered: