Im trying to create a virtual assistant but I cant get the gTTS working (google text to speech) working and I cant seem to fix it
import os
import time
import playsound
import speech_recognition as sr
from gtts import gTTS
def speak(text):
tts = gTTS(text = text, lang="en")
filename = "voice.mp3"
tts.save(filename)
playsound.playsound(filename)
speak("hello i am bob")
This is the error im getting
File "/Users/danielcaminero/Library/Mobile Documents/com~apple~CloudDocs/SJ-000/pyda/script.py", line 13, in <module>
speak("hello i am bob")
File "/Users/danielcaminero/Library/Mobile Documents/com~apple~CloudDocs/SJ-000/pyda/script.py", line 10, in speak
tts.save(filename)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts/tts.py", line 295, in save
self.write_to_fp(f)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts/tts.py", line 251, in write_to_fp
prepared_requests = self._prepare_requests()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts/tts.py", line 194, in _prepare_requests
part_tk = self.token.calculate_token(part)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts_token/gtts_token.py", line 28, in calculate_token
seed = self._get_token_key()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts_token/gtts_token.py", line 58, in _get_token_key
raise ValueError(
ValueError: Unable to find token seed! Did https://translate.google.com change?