I have a method that I found online. The purpose of the code is for python to say words. Code for the method is below:
def respond(output):
num=0
print(output)
num += 1
response=gTTS(text=output, lang='en')
file = str(num)+".mp3"
response.save(file)
playsound.playsound(file, True) # <-- Error here.
os.remove(file)
An error is occurring on the 7th line inside the function - playsound.playsound(file, True)
. I looked at another StackOverflow post where the person who had basically the same problem: Playsound throwing error "returned non-zero exit status 1", and I tried the solution that was recommended on the post. Unfortunately, I am still getting the same error. I'd like to ask if there is another solution to the problem I have.
Error message is:
Command '['/usr/bin/python3', '/usr/local/lib/python3.7/dist-packages/playsound.py', '1.mp3']'
returned non-zero exit status 1.