title: Error trapping combined with a counter not working
body: <p>I'm making a code that makes a user enter RLE line by line. I then send the entered data to a function that decodes it. Within the function, I've included some basic error trapping.</p>
  
  <p>My error is that when the user can only enter incorrect data the number of times they choose (they choose the amount of lines they want to enter). i.e. if the user enters 2 (out of 3) correct lines of RLE and then enters an incorrect line, the code won't ask to enter the RLE again, but if they enter an incorrect line at the first or second input it works.</p>
  
  <p>Code:</p>
  
  <pre class="lang-py prettyprint-override"><code>if line_amount&gt;2:
              print ("Please enter the compressed data one line at a time")
              while line_amount &gt; counter:
                  compressed_data = input('-&gt;') #ENTER RLE DATA
                  counter+=1
                  RLEtoASCII(compressed_data,counter)
  </code></pre>
  
  <p>RLEtoASCII:</p>
  
  <pre class="lang-py prettyprint-override"><code>def RLEtoASCII(compressed_data,counter):
      try:
          pairs = [(int(compressed_data[i:i+2]), compressed_data[i+2]) for i in range(0, len(compressed_data), 3)]
          global text
          text = ''.join(n * c for n, c in pairs)
          RLE_Inputs = open("Entered Data.txt", 'a+') #File that lists all the inputs
          #[etc all the file writing]
      except:
          print('THERE WAS A PROBLEM WITH THE VALUES Please re-enter values.\n')
  </code></pre>
  
  <p>If I try calling <code>RLEtoASCII</code> after the except, it creates a loop. <code>counter -=1</code> doesn't appear to work after the except either...</p>