title: Checking if a file exists in Python 2.7
body: <p>I am using a simple python script to search and play songs on my laptop. The code goes as follows :-</p>
  
  <pre><code>    import os
      d_name = raw_input("enter drive name:-")
      choice = raw_input("song or video(s/v):-")
      if(choice == 's'):
          s_name = raw_input("enter song name:- ")
          flag = 1
      elif(choice=='v'):
          s_name = raw_input("enter video name:-")
          flag = 2
      if(flag == 1):
          f_s_name = "start "+d_name+":/"+s_name+".mp3"
      elif(flag == 2):
          f_s_name = "start "+d_name+":/"+s_name+".mp4"
      dir_list = os.listdir("d_name:/")
      i=0
      while(1):
          if(not(os.system(f_s_name))):
              break
          else:
          if(flag == 1):
              f_s_name = "start "+d_name+":/"+dir_list[i]+"/"+s_name+".mp3"
           elif(flag == 2):
              f_s_name = "start "+d_name+":/"+dir_list[i]+"/"+s_name+".mp4"
       i = i+1
  </code></pre>
  
  <p>the above program works fine but when one of the calls to the function os.system() fails until the required condition matches it pops out a dialog box claiming that the song is not there until it is found. How can i prevent popping up of that dialog box? </p>