我正在为个人使用编写一个简单的Python 3.6.1聊天应用程序。在使用select.select时,我遇到了以下错误:
Traceback (most recent call last):
File "C:\Users\Nathan Glover\Google Drive\MAGENTA Chat\chat_server.py", line
27, in <module>
ready_to_read,ready_to_write,in_error = select.select(SOCKET_LIST,[],[],0)
ValueError: file descriptor cannot be a negative integer (-1)
这里是代码:
ready_to_read,ready_to_write,in_error = select.select(SOCKET_LIST,[],[],0)
完全是因为我不太了解select,而且文档也没有帮助。有人能解释一下为什么会发生这种情况吗?
-1
),我会看到相同的结果,但是如果在捕获错误后打印,那么我会看到fd=-1
。 - David Winiecki