title: How to fix 'TypeError: argument of type 'NoneType' is not iterable ' in python
body: <p>I am building the VUI for a virtual assistant as a hobby project using pyttsx3 and SpeechRecognition.
  i first made a function called <code>take_order()</code> then in the next function <code>run_agos()</code> i checked if <code>take_Order()</code> contains some keyword to start an other process, see this code:</p>
  <pre><code>import speech_recognition as sr
  import pywhatkit
  import datetime
  import winsound
  import wikipedia
  import pyjokes
  import pyttsx3
  
  listener = sr.Recognizer()
  engine = pyttsx3.init()
  
  def talk(text):
      engine.say(text)
      engine.runAndWait()
  
  
  def take_order():
      try:
          with sr.Microphone() as source:
              print('listening...')
              voice = listener.listen(source)
              command = listener.recognize_google(voice)
              command = command.lower()
              if 'alex' in command:
                  command = command.replace('alexa', '')
                  print(command)
              else:
                  return
              return command
      except pass
  
  
  
  def run_agos():
      task = take_order()
  
      if 'play' in task:
          song = task.replace('play', '')
          talk('playing ' + song)
          pywhatkit.playonyt(song)
      elif 'time' in task:
          time = datetime.datetime.now().strftime('%I:%M %p')
          print(time)
          talk('Current time is ' + time)
      elif 'who is' in task:
          person = task.replace('who is', '')
          try:
              info = wikipedia.summary(person, 1)
              print(info)
              talk(info)
          except wikipedia.exceptions.DisambiguationError as e:
              print(e.options)
              talk(person + 'may refer to')
              talk(e.options)
      elif 'what is' in task:
          thing = task.replace('what is', '')
          try:
              info = wikipedia.summary(thing, 1)
              print(info)
              talk(info)
          except wikipedia.exceptions.DisambiguationError as e:
              print(e.options)
              talk(thing + 'may refer to')
              talk(e.options)
      elif 'joke' in task:
          joke = pyjokes.get_joke()
          talk(joke)
          print(joke)
      else:
          talk('I did not hear that, pleas repeat the command.')
      return run_agos()
  
  
  while True:
      run_agos()
  </code></pre>
  <p>At first it works fine, however after a while I get <code>TypeError: argument of type 'NoneType' is not iterable</code> and the program shuts down. I also get the extit code: -1073741819 (0xC0000005).How can I fix this error so it will keep running the program?</p>