Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error engine.setProperty('voice', voices[1].id) #265

Open
Ray94520 opened this issue Mar 19, 2023 · 2 comments
Open

error engine.setProperty('voice', voices[1].id) #265

Ray94520 opened this issue Mar 19, 2023 · 2 comments

Comments

@Ray94520
Copy link

So I'm trying to learn Python here
and I'm doing it in pycharm in Windows 10

My first script I'm trying to learn
is speech recognition

Everything seems to be working okay
except for this one error I get

Class 'object' does not define 'getitem', so the '[]' operator cannot be used on its instances

which I do not understand

Here is my code

import speech_recognition as sr
import pyttsx3

listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id) <----is referring to this
engine.say('say, How can I help you.')
engine.runAndWait()

If I comment it out the error will go away but I'm left with a male voice
this is the only error I have and I don't understand it

@Akul2010
Copy link

I am making a more actively supported version of this. Please help. https://github.com/Akul-AI/rlvoice

@Jiangshan00001
Copy link

1 which system are you using?
2 can you show the full error message?
3 add print(voices) before the error line to show what voices is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants