title: UnboundLocalError: local variable 'T3' referenced before assignment "
body: <p>I am trying to compare certain values with diff times in CSV file. ex: iam searching for the first 27 bytes value and save its time. Then second 27 value and time is different from first one then save its time then third etc.The problem is when i try to save time to a variable to compare it with the second same value it gives me this error :</p>
  
  <p>UnboundLocalError: local variable 'T3' referenced before assignment 
  " </p>
  
  <pre><code>import csv
  import os
  import glob
  
  
  class dot(object):
      Time=""
      Payload=""
      Timediff=""
  
  global T1
  global T2
  global T3
  global T4
  
  def searchfunc():
      path = '/Users/mohamedshaaban/Downloads/tes/Camera'
      for infile in glob.glob( os.path.join(path, '*csv') ):
          with open(infile) as inf:
          reader = csv.reader(inf)
          partname = partsize = None
          partname2 = partsize2 = None
          partname3 = partsize3 = None
          partname4 = partsize4 = None
          partname5 = partsize5 = None
          camera = dot()
          camera.Payload1='30 bytes'
          camera.Payload2='27 bytes'
          camera.Payload3='17 bytes'
          camera.Payload4='5 bytes'
          camera.Payload5='6 bytes'
  
          for row in reader:
              if camera.Payload1 in row[2] and partname is None:
                  x = row[2]
                  partname = x[0:-1]
                  T1 = float(row[4])
              if camera.Payload2 in row[2] and partname2 is None:
                  x2 = row[2]
                  partname2 = x2[0:-1]
                  T2 = float(row[4])
                  #print partname2
                  #print Time2
              if camera.Payload2 in row[2] and partname3 is None: 
                  if float(row[4]) != T2:
                      T3 = float(row[4])
                      x3 = row[2]
                      partname4 = x3[0:-1]
                      print partname3
              if camera.Payload2 in row[2] and partname4 is None:
                  if float(row[4]) != T3:
                      T4 = float(row[4])
                      x4 = row[2]
                      partname4 = x4[0:-1]
                      print partname3
                      print Time5             
  
  
  
  
  searchfunc()
  </code></pre>