title: Python: finally gives SyntaxError
body: <p>I'm making a server with socket in Python. In line 22 is the SyntaxError. </p>
  
  <pre><code>import socket
  
  def create_socket():
      global s
      try:
          s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          s.bind(("", 50000))
          s.listen(1)
      except:
          print("[-] Can't start socket")
  def listener():
      global s
      try:
          while True:
              msg, ip = s.accept()
              while True:
                  data = msg.recv(1024)  
                  if not data:
                      msg.close()
                      break
                  print("[{}] {}".format(ip[0], data.decode())
      finally:
          s.close()
  
  create_socket()
  listener() 
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>line 22
      finally:
            ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>What I'm doing wrong?
  why is there this error?</p>