title: UnboundLocalError in python even when the variable is gloabally assigned
body: <p>Why running the following code block gives an unbound error when a have globally assigned Html_code_1 and Html_code 2. So why python interpreter taking it as a local variable. I am using vagrant machine to run this code.</p>
  
  <p>Following is the error message:</p>
  
  <pre><code>Exception happened during processing of request from ('10.0.2.2', 55545)
  Traceback (most recent call last):
    File "/usr/lib/python2.7/SocketServer.py", line 290, in 
  _handle_request_noblock
      self.process_request(request, client_address)
    File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
      self.finish_request(request, client_address)
    File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
      self.RequestHandlerClass(request, client_address, self)
    File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
      self.handle()
    File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
      self.handle_one_request()
    File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
      method()
    File "true.py", line 31, in do_GET
      Html_code_1 +="&lt;ul&gt;"
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
  from sqlalchemy import create_engine
  from sqlalchemy.orm import sessionmaker
  
  
  Html_code_1 = """
                &lt;!Doctype html&gt;
                &lt;head&gt;&lt;title&gt;Foodpanda.com&lt;/title&gt;&lt;/head&gt;
                &lt;body&gt;
  """    
  Html_code_2 = """
                &lt;/body&gt;
                &lt;/html&gt;
  """
  
  class webServerHandler(BaseHTTPRequestHandler):
      def do_GET(self):
          try:
              self.send_response(200)
              self.send_header('Content-type', 'text/html')
              self.end_headers()
              Html_code_1 +="&lt;ul&gt;"
              Html_code_1 += "&lt;/ul&gt;"+Html_code_2
              output = Html_code_1
              self.wfile.write(output.encode())
              return
          except IOError:
              self.send_error(404, 'File Not Found: %s' % self.path)
  def main():
      try:
          port = 8080
          server = HTTPServer(('', port), webServerHandler)
          print "Web Server running on port %s" % port
          server.serve_forever()
      except KeyboardInterrupt:
          print " ^C entered, stopping web server...."
          server.socket.close()
  
  if __name__ == '__main__':
      main()
  </code></pre>