Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No service has returned a valid result #53

Closed
hajosattila opened this issue Jul 8, 2023 · 3 comments
Closed

No service has returned a valid result #53

hajosattila opened this issue Jul 8, 2023 · 3 comments

Comments

@hajosattila
Copy link

hajosattila commented Jul 8, 2023

It doesn't work for me

script

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

@sinedie
Copy link
Owner

sinedie commented Jul 12, 2023

Hey!

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).

Hope it works

@sinedie sinedie closed this as completed Jul 12, 2023
@hajosattila
Copy link
Author

hajosattila commented Jul 13, 2023

WORKING!!!!!!!!!!!!

[alucard@arch ~/Downloads]$ python -m srtranslator --translator translatepy film.srt -i en -o hu
Loading film.srt
... Translating chunk. 0 %
... Translation done
Saving film_hu.srt

yeahhh!

@hajosattila
Copy link
Author

deepl api also works. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants