title: Send Data from Server to Client Python 2.7
body: <p>I am trying to write a server that reads a .pdf file and sends the data to a client server.</p>
  
  <p>Here is a snip of my server program.</p>
  
  <pre><code>while True: # infinite loop to connect to a client
      client, address = server.accept()
      data = copyfile(path)
      data = str(data)
      client.send(data.encode('utf-8'))
      client.close()
  </code></pre>
  
  <p>Here is a clip of my client source code:</p>
  
  <pre><code>client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  # assume my host and ports are correct
  client.connect((host, port))
  data = client.recv(1024)
  s = data.decode('utf-8')
  
  print s
  
  client.close()
  </code></pre>
  
  <p>Here is the error I am gettting:</p>
  
  <p>client.send(message.encode('utf-8'))</p>
  
  <p>UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 10: ordinal not in range(128)</p>