0

Following the code, I want to convert voice from the text. But I take error. File "C:\Users\fatma\Documents\python\voice_text\textaudio.py", line 16, in output.save("output.mp3") File "C:\Users\fatma\AppData\Local\Programs\Python\Python39\lib\site-packages\gtts\tts.py", line 328, in save with open(str(savefile), "wb") as f: FileNotFoundError: [Errno 2] No such file or directory: 'output.mp3'

How can I solve this problem?

from gtts import gTTS
import os

fh = open("test.txt", "r")
myText = fh.read().replace("\n", " ")   
language = 'en'   
output = gTTS(text=myText, lang=language, slow=False)    
output.save("output.mp3")
fh.close()       
os.system("start output.mp3")
FGY
  • 77
  • 6

0 Answers0