Python错误:io.UnsupportedOperation:fileno

mee*_*mee 16 python sockets

我正在使用此链接中的服务器和客户端程序:http://www.bogotobogo.com/python/python_network_programming_tcp_server_client_chat_server_chat_client_select.php

当我运行客户端时遇到以下错误:

Traceback (most recent call last):
  File "client.py", line 26, in client
    read_sockets, write_sockets, error_sockets =     select.select(socket_list , [], [])
io.UnsupportedOperation: fileno
Run Code Online (Sandbox Code Playgroud)

我正在使用Python 3,但我已经使用print来改变所有行Python 2 to 3.

这是代码:

while 1:
        socket_list = [sys.stdin, s]
        # Get the list sockets which are readable
        read_sockets, write_sockets, error_sockets = select.select(socket_list , [], [])
Run Code Online (Sandbox Code Playgroud)

Wol*_*lph 19

虽然fileno()方法适用于正常的IO对象(sys.stdout,sys.stderr,sys.stdinsocket.socket),空闲的Python IDE改变它打破这个您的IO对象.

所以...如果你收到这个错误,请直接从Python运行命令.