Я хочу создать голосового помощника, использующего pyttsx3 (конечно же, python).Я получаю несколько ошибок при использовании функции .init ().
import os
import time
import speech_recognition as sr
import pyttsx3
def talk(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
talk("Hello")
Это ошибки, которые я получаю ...
>Traceback (most recent call last):
File "/Users/tldr/PycharmProjects/voiceAssistantProject/venv/lib/python3.7/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/weakref.py", line 137, in __getitem__
o = self.data[key]()
KeyError: None
>During handling of the above exception, another exception occurred:
>Traceback (most recent call last):
File "/Users/tldr/PycharmProjects/voiceAssistantProject/voice_assistant1.py", line 12, in <module>
talk("Hello")
File "/Users/tldr/PycharmProjects/voiceAssistantProject/voice_assistant1.py", line 8, in talk
engine = pyttsx3.init()
File "/Users/tldr/PycharmProjects/voiceAssistantProject/venv/lib/python3.7/site-packages/pyttsx3/__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "/Users/tldr/PycharmProjects/voiceAssistantProject/venv/lib/python3.7/site-packages/pyttsx3/engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/Users/tldr/PycharmProjects/voiceAssistantProject/venv/lib/python3.7/site-packages/pyttsx3/driver.py", line 52, in __init__
self._driver = self._module.buildDriver(weakref.proxy(self))
File "/Users/tldr/PycharmProjects/voiceAssistantProject/venv/lib/python3.7/site-packages/pyttsx3/drivers/nsss.py", line 9, in buildDriver
return NSSpeechDriver.alloc().initWithProxy(proxy)
File "/Users/tldr/PycharmProjects/voiceAssistantProject/venv/lib/python3.7/site-packages/pyttsx3/drivers/nsss.py", line 19, in initWithProxy
self._tts.setDelegate_(self)
AttributeError: 'NoneType' object has no attribute 'setDelegate_'
>Process finished with exit code 1