2016-06-21 9 views
0

Wenn ich diesen Code ausführen, der direkt von der Website istPython - Fehler mit pyttsx

import pyttsx 
engine = pyttsx.init() 
engine.say('Greetings!') 
engine.say('How are you today?') 
engine.runAndWait() 

ich diesen Fehler:

Traceback (most recent call last): 
    File "C:\Users\Aymen\Desktop\AI.py", line 2, in <module> 
    engine = pyttsx.init() 
    File "C:\Python27\lib\site-packages\pyttsx\__init__.py", line 39, in init 
    eng = Engine(driverName, debug) 
    File "C:\Python27\lib\site-packages\pyttsx\engine.py", line 45, in __init__ 
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) 
    File "C:\Python27\lib\site-packages\pyttsx\driver.py", line 66, in __init__ 
    self._driver = self._module.buildDriver(weakref.proxy(self)) 
    File "C:\Python27\lib\site-packages\pyttsx\drivers\sapi5.py", line 37, in buildDriver 
    return SAPI5Driver(proxy) 
    File "C:\Python27\lib\site-packages\pyttsx\drivers\sapi5.py", line 56, in __init__ 
    self.setProperty('voice', self.getProperty('voice')) 
    File "C:\Python27\lib\site-packages\pyttsx\drivers\sapi5.py", line 87, in getProperty 
    return self._tts.Voice.Id 
    File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 466, in __getattr__ 
    return self._ApplyTypes_(*args) 
    File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 459, in _ApplyTypes_ 
    self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args), 
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147221164), None) 

im auf Windows 10 mit Python 2.7

+0

Gerade lief das in Mint-Linux mit Null-Probleme. Es ist wahrscheinlich etwas falsch mit der Installation von Pyttsx oder Python. – sage88

Antwort

0

installieren pywin32 dann stellen Sie sicher, dass pywintypes27.dll im Verzeichnis C: \ Windows \ System32 ist.

0

Wenn Sie python3 verwenden, verwenden Sie die pyttsx3 Bibliothek anstelle von pyttsx.

pip install pyttsx3

Es hat keine Fehler so weit wie ich getestet habe.

-1

Ich habe den gleichen Fehler auf einem Raspberry Pi.

Installierte pyttsx3 mit pip.

Kann mir jemand Hilfe geben?