title: chat server/client in python
body: <p>I using this chat server/client I'm getting a problem when trying to run the client side
  I'm using python 3.4 under windows for that line</p>
  
  <pre><code>ready_to_read,ready_to_write,in_error = select.select(socket_list , [], [])
  </code></pre>
  
  <p>WinError 10038 An operation was attempted on something that is not socket</p>
  
  <p>When I change this line <code>socket_list = [sys.stdin,s] to socket_list = [s]</code> then the error disappear but the program then not wait for input from client </p>
  
  <p>any idea ?</p>
  
  <p>this is the code </p>
  
  <pre><code># chat_client.py
  
  import sys
  import socket
  import select
  
  def chat_client():
      #if(len(sys.argv) &lt; 3) :
        #  print ('Usage : python chat_client.py hostname port')
        #  sys.exit()
  
      host = 'localhost'
      port = 10000
  
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      s.settimeout(2)
  
      # connect to remote host
      try :
          s.connect((host, port))
      except :
          print ('Unable to connect')
          sys.exit()
  
      print ('Connected to remote host. You can start sending messages')
      sys.stdout.write('[Me] '); sys.stdout.flush()
      prompt()
      while 1:
          socket_list = [sys.stdin,s]
  
          # Get the list sockets which are readable
          ready_to_read,ready_to_write,in_error = select.select(socket_list , [], [])
  
          for sock in ready_to_read:
              print('tset')
              if sock == s:
                  # incoming message from remote server, s
                  data = sock.recv(4096)
                  if not data :
                      print ('\nDisconnected from chat server')
                      sys.exit()
                  else :
                      #print data
                      sys.stdout.write(data)
                      sys.stdout.write('[Me] '); sys.stdout.flush()     
  
              else:
                  print('tset')
                  # user entered a message
                  #msg= input()
                  msg = sys.stdin.readline()
                  s.send(msg)
                  sys.stdout.write('[Me] '); sys.stdout.flush() 
  
  if __name__ == "__main__":
  
      sys.exit(chat_client())
  </code></pre>