question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gTTS failed while language code contains `-`

See original GitHub issue
(venv) ➜  gtts-cli --lang zh-cn 天氣好 --output hello.mp3
Error: 200 (OK) from TTS API. Probable cause: No audio stream in response. Unsupported language 'zh-cn'
(venv) ➜  gtts-cli --lang zh-CN 天氣好 --output hello.mp3
Error: 200 (OK) from TTS API. Probable cause: No audio stream in response. Unsupported language 'zh-cn'
(venv) ➜  gtts-cli --lang zh-cn 天氣好 --output hello.mp3
Error: 200 (OK) from TTS API. Probable cause: No audio stream in response. Unsupported language 'zh-cn'
(venv) ➜  gtts-cli --lang pt-br 天氣好 --output hello.mp3
Error: 200 (OK) from TTS API. Probable cause: No audio stream in response. Unsupported language 'pt-br'
(venv) ➜ gtts-cli --lang pt-br aa --output hello.mp3
Error: 200 (OK) from TTS API. Probable cause: No audio stream in response. Unsupported language 'pt-br'
(venv) ➜  gtts-cli --lang fr-ca aa --output hello.mp3
Error: 200 (OK) from TTS API. Probable cause: No audio stream in response. Unsupported language 'fr-ca'
(venv) ➜  gtts-cli --lang fr aa --output hello.mp3  (No Error)

Looks like google translate api become case sensitive. It only accept zh-TW instead of zh-tw now. So the following line need to fix.

https://github.com/pndurette/gTTS/blob/b36103df89e940b8d6c0cd744c341f80205815cb/gtts/tts.py#L146-L148

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bytefootcommented, Feb 5, 2021

@pndurette I think the brazil user you mentioned is right to some extent… In india, for ‘en’, ‘en-IN’ is recieved… I guess only selected regions recieve it. I also tried to change the tlds according to the regions, and i did find some variations (I tried only for ‘en’) , but i wasn’t able to label them… I mainly searched for my requirement (en-US) by using tld as ‘us’(instead of ‘com’) but as you tried with VMs; US, UK and Australia did remain same.

1reaction
bytefootcommented, Jan 29, 2021

I think bug label should be added to this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gTTS failed while language code contains `-` - Bountysource
(venv) ➜ gtts-cli --lang zh-cn 天氣好 --output hello.mp3 Error: 200 (OK) from TTS API. Probable cause: No audio stream in response.
Read more >
python gTTS RuntimeError: Unable to get language list ...
I use gTTS module.One day,this error suddenly happened.Yes,I have never handled these codes from the time of importing it.Until yesterday,this ...
Read more >
If you get an error using gtts module - python programming
The gtts module, is the api that python can use to access to the google text to speech engine, so that you can...
Read more >
Error if text > 200 char · Issue #252 · pndurette/gTTS - GitHub
I am currently running version 2.2.0 and it seems like if the text we are trying to convert is greater than 200 char,...
Read more >
Changelog - gTTS documentation
Python 2 support will be completely removed in the next major release. ... The following list of 'hyphenated' language codes no longer work...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found