sinedie / SRTranslator

SRT files translator
Do What The F*ck You Want To Public License
219 stars 27 forks source link

translation.splitlines() - AttributeError: 'NoneType' object has no attribute 'splitlines' #41

Closed X-Gorn closed 1 year ago

X-Gorn commented 1 year ago
from srtranslator import SrtFile
from srtranslator.translators.translatepy import TranslatePy
translator = TranslatePy()
filepath = "video.srt"
srt = SrtFile(filepath)
srt.translate(translator, "en", "id")

# Making the result subtitles prettier
srt.wrap_lines()

srt.save(f"{os.path.splitext(filepath)[0]}_translated.srt")
Traceback (most recent call last):
  File "/app/plugins/code_runner.py", line 24, in code_runner
    await aexec(cmd, bot, update)
  File "/app/plugins/code_runner.py", line 61, in aexec
    return await locals()["__aexec"](bot, update)
  File "", line 7, in __aexec
  File "/usr/local/lib/python3.9/site-packages/srtranslator/srt_file.py", line 156, in translate
    translation = translation.splitlines()
AttributeError: 'NoneType' object has no attribute 'splitlines'
sinedie commented 1 year ago

Did you got any print statement before the traceback?

X-Gorn commented 1 year ago

no.

sinedie commented 1 year ago

Should be fixed in v0.2.3

sinedie commented 1 year ago

Closed due to inactivity and it should work by now. Reopen if not