title: Python - NameError: name 'engine' is not defined / Driver not found
body: <p>I have been trying to work on an AI Project in PyCharm using this video: <a href="https://www.youtube.com/watch?time_continue=179&amp;v=rU_ppVsyJu8" rel="nofollow noreferrer">https://www.youtube.com/watch?time_continue=179&amp;v=rU_ppVsyJu8</a></p>
  <p>Here is the code:</p>
  <pre><code>import sys
  print(sys.path)
  
  import speech_recognition as sr
  import pyttsx3
  
  try:
      engine = pyttsx3.init()
  except ImportError:
      print(&quot;Driver not found&quot;)
  except RuntimeError:
      print(&quot;Driver fails to init&quot;)
  
  voices = engine.getProperty(&quot;voices&quot;)
  
  for voice in voices:
      print(voice.id)
  </code></pre>
  <p>And there is an error:</p>
  <p><a href="https://i.stack.imgur.com/b57tG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b57tG.png" alt="enter image description here" /></a></p>
  <p>Even though it says driver not found, I installed pyttsx3 right here:</p>
  <p><a href="https://i.stack.imgur.com/fupdg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fupdg.png" alt="enter image description here" /></a></p>
  <p>I have been tackling this problem for a week, and with it I can't move on. If someone helped that would be appreciated.</p>