Error if text > 200 char
See original GitHub issueI am currently running version 2.2.0
and it seems like if the text we are trying to convert is greater than 200 char, the conversion fails with the following message:
Traceback (most recent call last):
File "main.py", line 11, in <module>
myobj.save("audiobook.mp3")
File "/usr/local/lib/python3.8/dist-packages/gtts/tts.py", line 311, in save
self.write_to_fp(f)
File "/usr/local/lib/python3.8/dist-packages/gtts/tts.py", line 293, in write_to_fp
raise gTTSError(tts=self, response=r)
gtts.tts.gTTSError: 200 (OK) from TTS API. Probable cause: Unknown
Sample code to reproduce the problem:
from gtts import gTTS
finalChar = 201
language = 'en'
finalText = ""
for i in range(30):
finalText += "\n0123456789"
print(finalText[:finalChar])
myobj = gTTS(text=finalText[:finalChar], lang=language, slow=False)
myobj.save("audiobook.mp3")
if you change back finalChar
to 200
, the request works and the file is written on disk.
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (9 by maintainers)
Top Results From Across the Web
Error message when a user enters more characters than max ...
Sure this is possible! First, count the entered characters and then print out the message you'd like to ...
Read more >"Please enter a value using 200 characters or fewer." error on ...
If the phrase spam_prevention_registration_rejected is longer than 200 characters, then this error will occur instead of giving the actual ...
Read more >Can't figure out this error: text, ntext - SQLServerCentral
a CHAR(200) data would be padded with spaces all the way out to the full defined size of 200 characters. Like2SQL (4/11/2010). Thanks...
Read more >How to show error message when maximum limit exceed in ...
i had wrote the script,its allowing 1000 characters.its ok to me.at the same time need to show error message"text will not allow 1000...
Read more >character limit in text field - Microsoft Dynamics CRM Forum ...
I am running into an issue with a workflow inserting data from other fields. On the Task Entity the Subject field has a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since zh is not a language, Chinese does not work at all.
from gtts import gTTS tts = gTTS(“说中文”, lang=“zh-CN”) tts.save(“helloch.mp3”) tts = gTTS(“說中文”, lang=“zh-TW”) tts.save(“helloch.mp3”)
Get “gtts.tts.gTTSError: 200 (OK) from TTS API. Probable cause: Unknown” on both tts.save()
@KelvinKramp, @srugai & @NikithaNimbalkar:
The accents are back, just obtained differently!
I’ve added updated documentation on how to obtain local accents with the combination of the right language code (
lang
) and top-level domain (tld
)! See: https://gtts.readthedocs.io/en/latest/module.html#localized-accents