-->

EOFError randomly appeared while using PYTTSX and

2019-05-11 03:58发布

问题:

I was using PYTTSX yesterday with no issues at all - it was acting exactly as expected and working fine. However, when I tried to run the exact same code not two hours later it threw this error:

Traceback (most recent call last):
  File "C:\Python27\FUCK.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 64, in __init__
    self._module = __import__(name, globals(), locals(), [driverName])
  File "C:\Python27\lib\site-packages\pyttsx\drivers\sapi5.py", line 19, in <module>
    import win32com.client
  File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 11, in <module>
    import gencache
  File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 662, in <module>
__init__()
  File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 56, in __init__
_LoadDicts()
  File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 109, in _LoadDicts
version = p.load()
EOFError

and it has been throwing this error ever since. The code which was working fine before hasn't been changed at all, and the same code works fine on my Linux partition, this error seems to be windows exclusive. Any idea what it could be?

回答1:

It is a simple procedure:

  1. Go to python27 folder
  2. Search for dicts.dat
  3. Delete that folder

It will work because I have done it