Skip to content

gtts.tts.gTTSError: 200 (OK) from TTS API. Probable cause: Unknown #363

@iichelhadi

Description

@iichelhadi

Prerequisites

  • Did you update gTTS to the latest? (pip install --upgrade gTTS)

The issue was reported before but no solution seems to be working

Current Behaviour (steps to reproduce)

book = open(file, 'rb')
pdfReader = PyPDF3.PdfFileReader(book)
pages = pdfReader.numPages
print(pages)
finalText = ""
with pdfplumber.open(file) as pdf:
    for i in range(0, pages):
        page = pdf.pages[i]
        text = page.extract_text()
        finalText += text

len(finalText)

# Language in which you want to convert
language = 'en'
print('###### convert text #######')
myobj = gTTS(text=finalText, lang=language, slow=False)

# Saving the converted audio in a mp3 file named
myobj.save("processed.mp3")

Error

Traceback (most recent call last):
  File "/audio books/convert_script.py", line 52, in <module>
    myobj.save("processed.mp3")
  File "/home/miniconda3/envs/pdftomp3/lib/python3.10/site-packages/gtts/tts.py", line 329, in save
    self.write_to_fp(f)
  File "/home/miniconda3/envs/pdftomp3/lib/python3.10/site-packages/gtts/tts.py", line 310, in write_to_fp
    for idx, decoded in enumerate(self.stream()):
  File "/home/miniconda3/envs/pdftomp3/lib/python3.10/site-packages/gtts/tts.py", line 294, in stream
    raise gTTSError(tts=self, response=r)
gtts.tts.gTTSError: 200 (OK) from TTS API. Probable cause: Unknown

Environment

  • gTTS version: .2.4
  • Operating System version: Ubuntu 20.04 Focal Fossa

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions