问题描述
import pyttsx3
ob=pyttsx3.init()
voice=ob.getProperty('voices')
ob.say("happy independence day")
ob.runAndWait()
这是我尝试读取字符串“独立日快乐”的代码,但我无法这样做。.这里显示很多错误
C:\Users\tamta\PycharmProjects\pythonpractice\venv\Scripts\python.exe C:/Users/tamta/PycharmProjects/pythonpractice/august.py
Traceback (most recent call last):
File "C:\Users\tamta\PycharmProjects\pythonpractice\venv\lib\site-packages\pyttsx3\__init__.py",line 20,in init
eng = _activeEngines[driverName]
File "C:\Users\tamta\AppData\Local\Programs\Python\python37\lib\weakref.py",line 137,in __getitem__
o = self.data[key]()
KeyError: None
在处理上述异常期间,发生了另一个异常:
Traceback (most recent call last):
File "C:/Users/tamta/PycharmProjects/pythonpractice/august.py",line 3,in <module>
ob=pyttsx3.init()
File "C:\Users\tamta\PycharmProjects\pythonpractice\venv\lib\site-packages\pyttsx3\__init__.py",line 22,in init
eng = Engine(driverName,debug)
File "C:\Users\tamta\PycharmProjects\pythonpractice\venv\lib\site-packages\pyttsx3\engine.py",line 30,in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self),driverName,debug)
File "C:\Users\tamta\PycharmProjects\pythonpractice\venv\lib\site-packages\pyttsx3\driver.py",line 52,in __init__
self._driver = self._module.buildDriver(weakref.proxy(self))
File "C:\Users\tamta\PycharmProjects\pythonpractice\venv\lib\site-packages\pyttsx3\drivers\sapi5.py",in buildDriver
return SAPI5Driver(proxy)
File "C:\Users\tamta\PycharmProjects\pythonpractice\venv\lib\site-packages\pyttsx3\drivers\sapi5.py",line 47,in __init__
self.setProperty('voice',self.getProperty('voice'))
File "C:\Users\tamta\PycharmProjects\pythonpractice\venv\lib\site-packages\pyttsx3\drivers\sapi5.py",line 90,in getProperty
return self._tts.Voice.Id
_ctypes.COMError: (-2147024809,'The parameter is incorrect.',(None,None,None))
Process finished with exit code 1
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)