Home > other >  Python: voice reading failure reason?
Python: voice reading failure reason?

Time:11-09

The import pyttsx3
Engine=pyttsx3. The init ()
Engine. Say, 'here are read out the words')
Engine. RunAndWait ()

This small program don't know where the problems, to debug the situation is as follows:
"D: \ \ Program Files \ Python37-32 \ python exe" D:/python - base/practice. Py
Traceback (the most recent call last) :
File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ pyttsx3 \ set py", line 20, in the init
Eng=_activeEngines [driverName]
The File "D: \ \ Program Files \ Python37-32 \ lib \ weakref py", line 137, in the __getitem__
O=self. Data [key] ()
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (the most recent call last) :
The File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ pyttsx3 \ drivers \ sapi5 py", line 3, the in & lt; module>
The from comtypes. Gen import SpeechLib # comtypes
ImportError: always import a name 'SpeechLib' from 'comtypes. Gen (D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ comtypes \ gen \ set py)

During handling of the above exception, another exception occurred:

Traceback (the most recent call last) :
The File "D:/python - base/practice. Py", line 232, in & lt; module>
Engine=pyttsx3. The init ()
The File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ pyttsx3 \ set py", line 22, in the init
Eng=Engine (driverName, debug)
File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ pyttsx3 \ engine py", 30, the line in __init__
The self. The proxy=driver. DriverProxy (weakref proxy (self), driverName, debug)
File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ pyttsx3 \ driver py", line, 50 in __init__
The self. The _module=importlib. Import_module (name)
The File "D: \ \ Program Files \ Python37-32 \ lib \ importlib \ set py", line 127, in import_module
Return _bootstrap. _gcd_import (name [level:], package, level)
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 1006, in _gcd_import
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 983, in _find_and_load
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 967, in _find_and_load_unlocked
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 677, in _load_unlocked
The File "& lt; Frozen importlib. _bootstrap_external & gt;" , line 728, in exec_module
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 219, in _call_with_frames_removed
The File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ pyttsx3 \ drivers \ sapi5 py", line 6, the in & lt; module>
Engine=comtypes. Client. CreateObject (" SAPI. SpVoice ")
The File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ comtypes \ client \ set py", line 227, in CreateObject
Clsids=comtypes. GUID. From_progid (progid)
The File "D: \ \ Program Files \ Python37-32 \ lib \ site - packages \ comtypes \ GUID py", line 78, in from_progid
_CLSIDFromProgID (STR (progid), byref (inst.))
"File" _ctypes/callproc. C, line 935, in GetResult
OSError: [WinError - 2147221005] invalid string

Process finished with exit code 1
  • Related