title: Reducing count value to repeat a loop cycle is not working. The for loop in python has an exception handler that has a continue statement
body: <pre><code>for i in range(0, 650):
      s = ticket[i]
      try:
          response = resource.get(path='ticket/%s' % s[0]) # Get ticket data from RT server
      except urllib2.URLError, e: # If connection fails
          resource = RTResource(url, user, pwd, CookieAuthenticator) # Reconnect to RT server
          count -= 1 # Count re-connection attempts
          if count &lt; 0:
              print "Connection failed at ticket %s" % s[0]
              print "Got %s tickets out of %s" % {i + 1, len(ticket) + 1}
              wb.save(fname)
              sys.exit(1)
          print 'Trying again...'
          i -= 1
          continue
      count = 10
      ...more code here...
  </code></pre>
  
  <p>The above code executes well but will skip an iteration when exception is thrown. I am trying to decreament the value of i and then continuing the loop so that when exception is thrown, the loop will repeat for same value of i. When a value of i is skipped I lose one ticket from RT server. How do I fix it?</p>