title: Unable to split a tuple object in Python: 'tuple' object has no attribute 'split'
body: <p>When I try to run my program I get the error shown below:</p>
  <pre><code>Traceback (most recent call last):
  File &quot;/Volumes/USER/server.py&quot;, line 15, in &lt;module&gt;
  filename = message.split()[1]
  AttributeError: 'tuple' object has no attribute 'split'
  </code></pre>
  <p>I tried changing the value for
  filename = message.split()[0] but it didn't work.</p>
  <pre><code>#import socket module
  import socket 
  serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
  #Prepare a sever socket 
  serverName = socket.gethostname()
  serverPort = 1234
  serverSocket.bind(('', serverPort))
  serverSocket.listen(1)
  while True:     
  #Establish the connection    
      print('Ready to serve...')     
      connectionSocket, addr = serverSocket.accept()
      try:         
          message =  connectionSocket.recvfrom(1024)
          filename = message.split()[1]
          f = open(filename[1:])
          outputdata = f.read()
          #Send one HTTP header line into socket         
          header = 'HTTP/1.1 200 OK\r\n' +\
              'Connection: close\r\n' + \
              'Content-Type: text/html\r\n' + \
              'Content-Length: %d\r\n\r\n' % (len(outputdata))
          connectionSocket.send(header.encode())
          #Send the content of the requested file to the client
          for i in range(0, len(outputdata)):
              connectionSocket.send(outputdata[i].encode())
          connectionSocket.close()
      except IOError:
          #Send response message for file not found
          header = 'HTTP/1.1 404 Not Found\r\n\r\n'
          connectionSocket.send(header.encode())
          #Close client socket
          connectionSocket.close()
  serverSocket.close()
  </code></pre>
  <p>In the same directory as the program, server.py, I have a file called helloworld.html thats supposed to load when I go to the IP address of the server with the hard coded port and also show a 404 when I go to a file that doesn't exist. ex (192.168.1.2:1234/helloworld.html)</p>