Can select() be used with files in Python under Windows?

前端 未结 3 972
情话喂你
情话喂你 2020-12-06 07:07

I am trying to run the following python server under windows:

\"\"\"
An echo server that uses select to handle multiple clients at a time.
Entering any line          


        
3条回答
  •  独厮守ぢ
    2020-12-06 07:39

    Look like it does not like sys.stdin

    If you change input to this

    input = [server] 
    

    the exception will go away.

    This is from the doc

     Note:
        File objects on Windows are not acceptable, but sockets are. On Windows, the
     underlying select() function is provided by the WinSock library, and does not 
    handle file descriptors that don’t originate from WinSock.
    

提交回复
热议问题