问题描述
下面的程序给了我一个错误。这是我的程序:
import pyttsx3 as tts
def speak(text):
engine = tts.init("sapi5")
engine.say(text)
engine.runandwait()
speak('Hello user this is a test message.')
这是我收到的错误消息:
Traceback (most recent call last):
File "c:\Users\SIDDHESH\Projects\test.py",line 6,in <module>
speak('Hello user this is a test message.')
File "c:\Users\SIDDHESH\Projects\test.py",line 5,in speak
engine.runandwait()
AttributeError: 'Engine' object has no attribute 'runandwait'
我想指出我的变量名为 engine
,但错误消息说明了有关变量 'Engine'
的一些内容。我还想指出,我正在使用 Visual Studio Code 来运行我的代码。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)