Reputation: 83
I have a python script that I made and it uses pyttsx for text to speech output. Whenever I converted it to an exe using py2exe and tried running the exe I get the following error:
Traceback (most recent call last):
File "main.py", line 8, in <module>
File "pyttsx\__init__.pyc", line 39, in init
File "pyttsx\engine.pyc", line 45, in __init__
File "pyttsx\driver.pyc", line 66, in __init__
File "pyttsx\drivers\sapi5.pyc", line 37, in buildDriver
File "pyttsx\drivers\sapi5.pyc", line 46, in __init__
File "win32com\client\__init__.pyc", line 317, in WithEv
AttributeError: 'NoneType' object has no attribute 'CLSID'
Here is a copy of my setup.py:
from distutils.core import setup
import py2exe
setup(
console=['main.py'],
options = {
"py2exe":{
"includes":[
'pyttsx.drivers.sapi5'
]
}
}
)
Upvotes: 4
Views: 406
Reputation: 365
You should try running with pyttsx3 and use your system's text to speech api like sapi 5 for windows. Its much faster and more recent.
Upvotes: 0
Reputation: 26139
YEY - I got it working!
from distutils.core import setup
import py2exe
py2exe_options = { 'includes': ['pyttsx.drivers.sapi5', 'win32com.gen_py.C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4'],
'typelibs': [('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 4)] }
setup(console=['main.py'], options = {'py2exe': py2exe_options})
Note though that this requires you to run the same version (v5.4 in my case) on both machines. If you want to circumvent that you probably need to try something more advanced.
Upvotes: 3