使用python的Voice Assistant显示循环错误

嗨,我正在尝试使用唤醒命令在python中创建语音助手,但是它给定了循环错误

我是pyttx3的新手,所以无法找到可以解决此问题的地方。

有些循环错误我无法修复,请帮助使其正常工作。

import pyjokes

client = wolframalpha.Client(app_id)

engine = pyttsx3.init() 
voices = engine.getProperty('voices') 
engine.setProperty('voice',voices[1].id) 


def speak(text):
    engine.say(text)
    engine.runAndWait()
   
WAKE = "hello jack"
SERVICE = authenticate_google()
print("Start")
while True:
    text = get_audio()

    if text.count(WAKE) > 0:
        speak("I am ready")
        text = get_audio()

        CALENDAR_STRS = ["what do i have","do i have","am i busy"]
        for phrase in CALENDAR_STRS:
            if phrase in text:
                date = get_date(text)
                if date:
                    get_events(date,SERVICE)
                else:
                    speak("I don't understand")

        NOTE_STRS = ["make a note","write this down","remember this"]
        for phrase in NOTE_STRS:
            if phrase in text:
                speak("What would you like me to write down?")
                note_text = get_audio()
                note(note_text)
                speak("I've made a note of that.")
    
RuntimeError: run loop already started

相关文章

功能概要:(目前已实现功能)公共展示部分:1.网站首页展示...
大体上把Python中的数据类型分为如下几类: Number(数字) ...
开发之前第一步,就是构造整个的项目结构。这就好比作一幅画...
源码编译方式安装Apache首先下载Apache源码压缩包,地址为ht...
前面说完了此项目的创建及数据模型设计的过程。如果未看过,...
python中常用的写爬虫的库有urllib2、requests,对于大多数比...