title: Python got back to beging start
body: <p>Is there a reason why my script won't go back to start. I want to go back to the beginning of this file when omxprocess is done in the command line I just get have a nice day ;) when the file is done playing. Is there a way to get it to go back to start and loop this file?</p>
  
  <pre><code>import re
  import os
  import sys
  import subprocess
  import re
  import speech_recognition as sr
  from os import path
  from pydub import AudioSegment
  import time
  
  def start():
      # transcribe audio file
      AUDIO_FILE = "test.wav"
  
      # use the audio file as the audio source
      r = sr.Recognizer()
      with sr.AudioFile(AUDIO_FILE) as source:
          audio = r.record(source)  # read the entire audio file
  
      # print(r.recognize_google(audio)) 
      #END AUDIO TRANSCRIBE
  
   def string_found(string1, string2):
      return re.search(r"\b" + re.escape(string1) + r"\b", string2)
  
   def find_words(text, words):
      return [word for word in words if string_found(word, text)]
  
   keyword = str(r.recognize_google(audio))
   sentences = (keyword)
   search_keywords=[ 'theme', 'son', 'serial','bonnie','cereal']
   print (sentences)
  
   found = find_words(sentences, search_keywords)
   name = re.sub('\W+','', str(found))
   print (name)
   #print(name.strip('mo'))
   # Open the file for reading
   with open('input.txt') as fd:
  
      # Iterate over the lines
      for line in fd:
  
          # Capture one-or-more characters of non-whitespace after the initial match
          match = re.search(rf'.*{name}.* : (\S+)', line)
          print (match)
          # Did we find a match?
          if match:
              # Yes, process it
              music = match.group(1)
              print('{}'.format(music))
             # omxprocess = subprocess.Popen(['omxplayer', '-olocal', music],  stdin=subprocess.PIPE, stdout=None, stderr=None, bufsize=0)
              time.sleep(5)
             # omxprocess.stdin.write(b'q')
  start()
  </code></pre>