Search code examples
python-3.xtext-to-speechpyttsx

python pyttsx3 error -- _pickle.UnpicklingError: invalid load key, '\x00'


i am trying to convert text to speech using pyttsx3 in python. but iam getting the error -- _pickle.UnpicklingError: invalid load key, '\x00'. it worked once. later it didn't

my code

import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()

error i am receiving is --

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\pyttsx3__init__.py", line 20, in init

eng = _activeEngines[driverName]

File "C:\ProgramData\Anaconda3\lib\weakref.py", line 137, in getitem

o = self.data[key]()

KeyError: None

During handling of the above exception, another exception occurred:

...

File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\gencache.py", line 113, in _LoadDicts

version = p.load()

_pickle.UnpicklingError: invalid load key, '\x00'.

python version is 3.7.3 | pyttsx3 version is 2.71| pywin32 version is 224

please help


Solution

  • I had this problem as well and fixed it by deleting gen_py in my temp directory.

    You can find this folder here:

    C:\Users\USERNAME\AppData\Local\Temp\gen_py