I am trying to write a socket server. The server itself doesn’t accomplish anything all that interesting. Right now my problem is that python is complaining about my arguments to select. Here is a snippet of code.
read_client_sockets=[the_socket, clients]
write_client_sockets=[clients, signals]
error=[]
#This is the loop that does most everything.
while 1:
#try to find someone who is ready for input
ready_to_read, ready_to_write, in_error = select.select(all_client_sockets, write_client_sockets, error)
Here is the complaint that I receive from my compiler. I have tried tweaking the arguments and end up getting the same result. Also I want this to run in blocking mode. As far as i know it is okay to not specify a timeout parameter; according to documentation I believe it is optional. Thank you for your time. I apologize for not having something more interesting to consider.
File "server.py", line 58, in main
ready_to_read, ready_to_write, in_error = select.select(all_client_sockets, write_client_sockets, error)
TypeError: argument must be an int, or have a fileno() method.
You need to pass in three sequences of file descriptors as arguments to select, from the names you supply I think that
[clients, signals]might be some other construct (is clients a list of file descriptors?). In this case you could useclients+signalsas second argument toselect.In other words: Each argument must be a flat sequence, no nesting is allowed.