title: python try/exception help
body: <p>I'm trying to support repetition where the user inputs a filename, then inputs two integers. So if an exception is thrown, I want the user to be prompted with input again.  </p>
  
  <p>My problem is if a valid file is entered but an invalid integer is entered it will ask for the file again instead of just the integer.  How can I fix the code so it will ask for the integer again.</p>
  
  <p>Here is what I have: </p>
  
  <pre><code>while True:
      try:
          f = raw_input("Enter name of file: ")
          inFile = open(f)
          # more code
      except IOError:
          print ("The file does not exist. Try Again.")        
      else:    
          try:
              integer = int(raw_input("Enter an integer: "))
              integer2 = int(raw_input("Enter an integer: "))
              # more code
          except (TypeError, ValueError):
              print ("Not an integer. Try Again.")
  </code></pre>