From b0055522c35f1251abfa9c8c96c2149a81a5bf8f Mon Sep 17 00:00:00 2001 From: 3ter Date: Thu, 5 Nov 2020 12:10:13 +0100 Subject: [PATCH] Workaround 'unable to find token seed' exception https://github.com/luoliyan/chinese-support-redux/issues/161 --- chinese/tts.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chinese/tts.py b/chinese/tts.py index e60c8e0..52f094a 100644 --- a/chinese/tts.py +++ b/chinese/tts.py @@ -53,7 +53,15 @@ def download(self): def get_google(self): tts = gTTS(self.text, lang=self.lang) - tts.save(self.path) + # Code inserted from https://github.com/pndurette/gTTS/issues/232 + count=1 + while True: + try: + tts.save(self.path) + break + except: + print('got the issue from https://github.com/luoliyan/chinese-support-redux/issues/161 '+str(count) + ' times.') + count+=1 def get_baidu(self): query = {