1

I am trying to create my own personal assistant through the following tutorial http://letsmakerobots.com/node/41226

I am struggling to understand why this code;

import pyttsx   # text-to-speech library
engine = pyttsx.init()   # initiates speech engine
engine.say('Hello World')   # loads text into engine
engine.runAndWait()   # THIS LINE IS IMPORTANT, runs the speech engine

is producing the following result;

Traceback (most recent call last):
  File "C:/Users/theo/AppData/Local/Programs/Python/Python36-32/VAtest.py", line 1, in <module>
    import pyttsx   # text-to-speech library
  File "C:\Users\theo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyttsx\__init__.py", line 18, in <module>
    from engine import Engine
ModuleNotFoundError: No module named 'engine'

When run from the command line it produces the following;

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'engine' is not defined

Now I can see from the output that it seems to think there is not a module called engine but I cant see why; I have followed the tutorial correctly.

Thank you all I was using the wrong versions of programs, after an hour of testing I have resolved with a working build.

1 Answers1

0

open python console (in a shell type python) and type import pyttsx if the result is

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named pyttsx

the module pyttsx is not installed correctly

see this pyttsx: No module named 'engine' and this import pyttsx works in python 2.7, but not in python3

Community
  • 1
  • 1
ralf htp
  • 9,149
  • 4
  • 22
  • 34