Timeout
Closed this issue · 5 comments
I always get a timeout response for the first step when selecting the language "auto" and "en-US".
import os
import glob
from srtranslator import SrtFile
from srtranslator.translators.deepl import DeeplTranslator
folder = r"Path"
for filepath in glob.glob(os.path.join(folder, "**/*.srt"), recursive=True):
# Creates a new translator each time in case you dont provide a driver, this way,
# DeeplTranslator creates a proxy and avoid getting banned
translator = DeeplTranslator()
srt = SrtFile(filepath)
srt.translate(translator, "auto", "en-US")
srt.wrap_lines()
srt.save(f"{os.path.splitext(filepath)[0]}_translated.srt")
translator.quit()
Okay... couldn't replicate. But as a pointer, maybe if you know the source language, you could use it instead of "auto" keyword.
If the issue won't go away, send me the error traceback so I can see it. Cause it works on my side.
Ok... can you check that you have the last version?
If so, try to add this at the beggining of your script
try:
os.environ.pop("MOZ_HEADLESS")
except:
pass
And see if subtitle is being written to textarea.
If that doesnt work, you could use -s flag in cli like this:
python -m srtranslator -i ja -o en-US -s ./path_to_file.srt
And tell me what you see... Probably is not the last version, but make sure.
Really odd. I updated to the latest version when released, but it seems it did something wrong when I updated it the first time. Now it is working, but using the "auto" detection for input leads to a german output (i suppose region detection for auto suggestion as output from deepl), even though en-US is selected. Specifiyng the input and output language works just fine.
Glad to hear it works!
I just find out that "auto" detection bug. Yeah, it is DeepL region detection.
Gonna make a new issue and close this one as it is solve. Ty for caching this