nateshmbhat / pyttsx3

Offline Text To Speech synthesis for python
Mozilla Public License 2.0
2.06k stars 326 forks source link

Error on Windows 10 #20

Open marianoo-andres opened 6 years ago

marianoo-andres commented 6 years ago

Hi. Im trying to run the following example on my Windows 10 pc. import pyttsx3 engine = pyttsx3.init() engine.say('Sally sells seashells by the seashore.') engine.say('The quick brown fox jumped over the lazy dog.') engine.runAndWait()

I get the following error: Traceback (most recent call last): File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3__init__.py", line 44, in init eng = _activeEngines[driverName] File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\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 "asd.py", line 2, in engine = pyttsx3.init() File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3__init.py", line 46, in init eng = Engine(driverName, debug) File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\engine.py", line 52, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\driver.py", line 77, in init self._driver = self._module.buildDriver(weakref.proxy(self)) File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\drivers\sapi5.py", line 22, in buildDriver return SAPI5Driver(proxy) File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\drivers\sapi5.py", line 41, in init__ self.setProperty('voice', self.getProperty('voice')) File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\drivers\sapi5.py", line 83, in setProperty self._tts.Voice = token File "C:\Users\maria\AppData\Local\Programs\Python\Python36\lib\site-packages\win32com\client\dynamic.py", line 549, in setattr self.oleobj.Invoke(entry.dispid, 0, invoke_type, 0, value) pywintypes.com_error: (-2147352573, 'Member not found.', None, None)

Any idea what this could be?

Thanks.

OlisProgramming commented 6 years ago

I also have the same error message on Windows 10 running Python 3.6 (32-bit).

SwiftPython commented 6 years ago

I have the same error running the 64-bit version of Python 3.6.6 on Windows 10.

rhinorap commented 6 years ago

I have the same error also - this is a BIG problem. The whole module is nerfed.

Windows 10 Python 3.7.0 and lower - same errors.

josephalway commented 5 years ago

Trying setting the voice to 0 or 1: (Voice 0 is Microsoft David, and Voice 1 is Microsoft Zira) engine.setProperty('voice', voices[1].id)

You may also need to install pypiwin32. pip install pypiwin32

CycloneBoy commented 5 years ago

engine.setProperty('voice', voices[1].id) engine.setProperty('voice', 0) or engine.setProperty('voice', 1) def speech_hello(): engine = pyttsx3.init() engine.setProperty('voice', 0) engine.say('hello world') engine.say('你好吗') engine.runAndWait()