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

2mn latency at the save step #425

Closed
FockeOeuf opened this issue Sep 5, 2023 · 3 comments
Closed

2mn latency at the save step #425

FockeOeuf opened this issue Sep 5, 2023 · 3 comments

Comments

@FockeOeuf
Copy link

Prerequisites

  • [x ] Did you make sure a similar issue didn't exist?
  • [x ] Did you update gTTS to the latest? (pip install --upgrade gTTS)

Current Behaviour (steps to reproduce)

I'm using gTTS on a Rockpi4b which I just migrated from Debian 10 to 11. As I got rid from Python 2.7 in the process, I started to have big latency in gTTS files generation. So I decided to completely clean Python (uninstall all Python versions and erasing any remaining Python lib from /usr/local/lib), reinstall Python 3.9 and gTTS, but to no avail.
When using either the API or gtts-cli, the mp3 file save takes around 1mn30s / 2mn.
A simple

sudo gtts-cli "c'est la vie" --lang fr --nocheck --output cestlavie.mp3 --debug

hangs at this point

gtts.tts - DEBUG - text: c'est la vie
gtts.tts - DEBUG - tld: com
gtts.tts - DEBUG - lang: fr
gtts.tts - DEBUG - slow: False
gtts.tts - DEBUG - lang_check: False
gtts.tts - DEBUG - pre_processor_funcs: [<function tone_marks at 0x7f9ba98040>, <function end_of_line at 0x7f9ba98940>, <function abbreviations at 0x7f9ba989d0>, <function word_sub at 0x7f9ba98a60>]
gtts.tts - DEBUG - tokenizer_func: <bound method Tokenizer.run of re.compile('(?<=\\?).|(?<=!).|(?<=?).|(?<=!).|(?<!\\.[a-z])\\. |(?<!\\.[a-z]), |(?<!\\d):|;|…|,|\\(|\\\n|—|¿|‥|،|\\[|。|、|\\]|¡|:|\\)', re.IGNORECASE) from: [<function tone_marks at 0x7f9ba98c10>, <function period_comma at 0x7f9ba98ca0>, <function colon at 0x7f9ba98d30>, <function other_punctuation at 0x7f9ba98dc0>]>
gtts.tts - DEBUG - pre-processing: <function tone_marks at 0x7f9ba98040>
gtts.tts - DEBUG - pre-processing: <function end_of_line at 0x7f9ba98940>
gtts.tts - DEBUG - pre-processing: <function abbreviations at 0x7f9ba989d0>
gtts.tts - DEBUG - pre-processing: <function word_sub at 0x7f9ba98a60>
gtts.tts - DEBUG - text_parts: ["c'est la vie"]
gtts.tts - DEBUG - text_parts: 1
gtts.tts - DEBUG - data-0: f.req=%5B%5B%5B%22jQ1olc%22%2C%22%5B%5C%22c%27est%20la%20vie%5C%22%2C%5C%22fr%5C%22%2Cnull%2C%5C%22null%5C%22%5D%22%2Cnull%2C%22generic%22%5D%5D%5D&

After 2mn, success the file is generated as intended.

gtts.tts - DEBUG - headers-0: {'Referer': 'http://translate.google.com/', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36', 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8', 'Content-Length': '148'}
gtts.tts - DEBUG - url-0: https://translate.google.com/_/TranslateWebserverUi/data/batchexecute
gtts.tts - DEBUG - status-0: 200
gtts.tts - DEBUG - part-0 written to <_io.BufferedWriter name='cestlavie.mp3'>
gtts.tts - DEBUG - part-0 created

Expected Behaviour

On my Windows PC on the same network, using the same DNS, gTTS works fine without any latency during the save step.

Context

I detected the issue as I'm running a Jeedom plugin using gTTS. Any TTS command has a 2mn latency now, and I pinpointed the issue at gTTS save step.

Environment

  • gTTS version: 2.3.2
  • Operating System version: Debian 11.7 / Python 3.9
Requirement already satisfied: gTTS in ./python3.9/dist-packages (2.3.2)
Collecting gTTS
  Using cached gTTS-2.3.2-py3-none-any.whl (28 kB)
  Downloading gTTS-2.3.1-py3-none-any.whl (28 kB)
Requirement already satisfied: requests<3,>=2.27 in ./python3.9/dist-packages (from gTTS) (2.31.0)
Requirement already satisfied: click<8.2,>=7.1 in ./python3.9/dist-packages (from gTTS) (8.1.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from requests<3,>=2.27->gTTS) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests<3,>=2.27->gTTS) (2020.6.20)
Requirement already satisfied: charset-normalizer<4,>=2 in ./python3.9/dist-packages (from requests<3,>=2.27->gTTS) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests<3,>=2.27->gTTS) (2.10)
@FockeOeuf
Copy link
Author

There may be a lib version issue.
I can't seem to find out which dependencies versions need to be installed and how to have a stable gtts install.
I've started fresh after uninstalling and reinstalling python3 entirely, but same behavior as previously.

At some point it worked as intended, but I can't pinpoint what is wrong...

@FockeOeuf FockeOeuf reopened this Sep 6, 2023
@FockeOeuf
Copy link
Author

Ok this was a network issue, uninstalled ifupdown for network-manager and it is ok now...

@pndurette
Copy link
Owner

Ah, glad you figured it out!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants