I'm trying to install TTS package by using this. Everything was okay until I tried to execute the following command:
import pyttsx
I got back this error:
File "/usr/local/lib/python3.4/dist-packages/pyttsx/__init__.py", line 18, in module <br>
from engine import Engine<br>
ImportError: No module named 'engine'
Any help would be appreciated. Thank you!
I just had the same problem, try using pyttsx3 instead of pyttsx First install pyttsx3
and change the
for
After that you have to change engine import (if you're using it in your main .py file). Use engineio instead. Install it
then change import engine for import engineio and change your variables.
Here's an example
Hope this helps someone
I found out the solution. Library was created in python2 language and there are not a lot of differences between those 2 versions, but exclusively in this case that occurs.
Move to your DP folder and change in engine.py "except Exception as e" instead of "except Exception, e", line 67. Do the same in drive.py, line 105.
Because of files are secured try to execute, e. g.
I guess I helped everyone with that kind of problem. :)
Guys there is an updated package compatible with Python3 :
pyttsx3
Works offline with no delay in the sound produced.
Installation:
Visit https://pyttsx3.readthedocs.io for the full usage docs. Thanks!
For Python3, please install the latest version via pip3 install pyttsx3 and in coding call import pyttsx3
I used this code after
and it worked perfectly for me
Combining the advice from Jacob Tsui and Jokhongir Mamarasulov worked for me. To summarize:
In site_packages/pyttsx/init.py, modify "from engine import Engine" to
Then, in site_packages/pyttsx/engine.py,
Modify
import driver
toModify
except Exception, e
toAnd finally, in site_packages/pyttsx/driver.py modify
except Exception, e
toSee the responses from the aforementioned authors for the rationale behind these changes.