title: Python Error: local variable referenced before assignment
body: <p>Here is my code:</p>
  
  <pre><code>import time
  
  GLO = time.time()
  
  def Test():
      print GLO
      temp = time.time();
      print temp
      GLO = temp
  
  Test()
  </code></pre>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "test.py", line 11, in
    
        Test()   File "test.py", line 6, in Test
        print GLO UnboundLocalError: local variable 'GLO' referenced before assignment</p>
  </blockquote>
  
  <p>the error occurred when I add the <code>GLO = temp</code>, if I comment it, the function could be execute successfully, why?</p>
  
  <p>How can I set <code>GLO = temp</code>?</p>