-1

SO here I imported pyttsx3 and wanted my ai to speak but it gave me a error full error here https://drive.google.com/file/d/12fa4KdSQ6JiEYjJHljc3JuLiFW-eYtKD/view?usp=sharing

import pyttsx3

Assistant = pyttsx3.init('sapi.5')
voices = Assistant.getProperty('voices')
print(voices)
Assistant.setProperty('voices',voices(1).id)
def Speak(audio):
    print("   ")
    Assistant.say(audio)
    print("   ")
    Assistant.runAndWait()


Speak('Hello sir, I am Y.P.A')
Leonardo
  • 2,439
  • 33
  • 17
  • 31

1 Answers1

0

You have a typo when initializing your Assistant

Assistant = pyttsx3.init('sapi5')
Jerven Clark
  • 1,191
  • 2
  • 13
  • 26
  • Thx for your help but now it gave me one more error!:( PS C:\Users\yuvra\Desktop> & C:/Users/yuvra/AppData/Local/Programs/Python/Python310/python.exe c:/Users/yuvra/Desktop/Pranks/Chatbots/Y.P.A.py [, ] Traceback (most recent call last): File "c:\Users\yuvra\Desktop\Pranks\Chatbots\Y.P.A.py", line 6, in Assistant.setProperty('voices',voices(1).id) TypeError: 'list' object is not callable PS C:\Users\yuvra\Desktop> – Yuvraj_333 Dec 16 '21 at 03:42
  • Now it gave me a new error:( `TypeError: 'list' object is not callable` – Yuvraj_333 Dec 16 '21 at 03:49
  • also `PS C:\Users\yuvra\Desktop> & C:/Users/yuvra/AppData/Local/Programs/Python/Python310/python.exe c:/Users/yuvra/Desktop/Pranks/Chatbots/Y.P.A.py [, ] Traceback (most recent call last): File "c:\Users\yuvra\Desktop\Pranks\Chatbots\Y.P.A.py", line 7, in Assistant.setProperty('voices',voices(1).id) TypeError: 'list' object is not callable PS C:\Users\yuvra\Desktop> ` – Yuvraj_333 Dec 16 '21 at 03:50
  • This one is also a typo for the way you are accessing the list. Instead of `voices(1).id` do `voices[1].id`. Installing a linter for your editor can help you solve most of these. – Jerven Clark Dec 16 '21 at 04:03