修改speech.py
line59 修改import thread,改成import threading
line157 修改print prompt,改成print(prompt)
对最后的函数_ensure_event_thread修改如下:
class T(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
pass
def _ensure_event_thread():
"""
Make sure the eventthread is running, which checks the handlerqueue
for new eventhandlers to create, and runs the message pump.
"""
global _eventthread
if not _eventthread:
def loop():
while _eventthread:
pythoncom.PumpWaitingMessages()
if _handlerqueue:
(context,listener,callback) = _handlerqueue.pop()
# Just creating a _ListenerCallback object makes events
# fire till listener loses reference to its grammar object
_ListenerCallback(context, listener, callback)
time.sleep(.5)
_eventthread = T()
_eventthread.start()