Select Module: Encountering a TypeError with socket server. [Python] -


the problem lies directly select.select line in socket server.

r_list, w_list, x_list = select.select(u_connections + [ss], username_list, []) 

where:

username_list = [] u_connections = [] 

the problem lies username_list.

username_list supposed 1 thing, , store usernames server receives. whenever server receives data, checks if has username (data received ) in username_list.

if it's there, moves on, , ignores received data.

if isn't, adds data list, , sends connected clients new username. program crashes.

if data:     translated_data = data.decode()     print(translated_data)     print("2")     if translated_data in username_list:         pass     else:         translated_data_string = str(translated_data)         username_list.append(translated_data_string)    <--- here         print("3") 

as stage completes, while loop re-executes. , in process encounters typeerror. occurs whenever added w_list.

what doing wrong, how supposed use select module make work?

all need append usernames list, , send if username recieves isn't in existing list.

i've been trying fix while, , did looking around, can't seem find fix.

i read this:

"in other words: each argument must flat sequence, no nesting allowed."

in this thread. don't understand being done wrong.

the full code server on pastebin here (note have except: catching typeerror)

if please kindly explain how not correctly interpreting select module, appreciative. don't want ask stupid questions.

error encountered:

traceback (most recent call last):   file "c:\users\owatch\documents\unisung\produced content\netsendclient[0.7]\netsendclient[0.7]\netsendclient\files\program_files\username_server.py", line 23, in <module>     r_list, w_list, x_list = select.select(u_connections + [ss], username_list, []) typeerror: argument must int, or have fileno() method. 


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -