0

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

1 Answers1

3

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
Thimo1
  • 99
  • 5
  • Thanks. I could not access the folder through windows. So, I used DOS, located the exact path and renamed the folder. – Fred Mar 02 '22 at 08:00