title: TypeError: str() takes at most 1 argument (2 given) and TypeError: an integer is required
body: <p>I am trying to access the non-existed file type by <a href="http://myipaddr:50997/notExisted.html" rel="nofollow noreferrer">http://myipaddr:50997/notExisted.html</a>
  but I am getting the following error.
  Can someone explain to me?</p>
  
  <pre><code>
      from socket import *
      serverPort = 50997
  
      serverSocket = socket(AF_INET, SOCK_STREAM)         
  
      serverSocket.bind(("", serverPort))
  
      serverSocket.listen(1)
  
      # Server should be up and running and listening to the incoming    connections
      while True:
      print ("Ready to serve...")
  
          # Set up a new connection from the client
          connectionSocket, addr = serverSocket.accept()
  
          try:
              # Receives the request message from the client
              message =  connectionSocket.recv(1024)
              print ("Message is: "), message
  
              filename = message.split()[1]
              print ("File name is: "), filename
  
              f = open(filename[1:])
  
              outputdata = f.read()
              connectionSocket.send("HTTP/1.1 200 OK\r\n\r\n")
  
      for i in range(0, len(outputdata)):  
          connectionSocket.send(outputdata[i])
      connectionSocket.send("\r\n")
  
      # Close the client connection socket
      connectionSocket.close()
  
  except IOError:
      # Send HTTP response message for file not found
      connectionSocket.send("HTTP/1.1 404 Not Found\r\n\r\n")
      connectionSocket.send("&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;404 Not Found&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;\r\n")
      # Close the client connection socket
      connectionSocket.close()
  
      serverSocket.close() 
  </code></pre>
  
  <p>The error that I am getting.</p>
  
  <pre><code>connectionSocket.send(bytes("HTTP/1.1 404 Not Found\r\n\r\n","UTF-8"))
  TypeError: str() takes at most 1 argument (2 given)
  </code></pre>
  
  <p>I have this error when I try to remove the bytes();</p>
  
  <pre><code>Traceback (most recent call last):
    File "tcpServer.py", line 26, in &lt;module&gt;
      connectionSocket.send("HTTP/1.1 404 Not Found\r\n\r\n","UTF-8")
  TypeError: an integer is required
  </code></pre>