Skip to content

does not work with tkinter and socket and real-time print #25

@davejakenic

Description

@davejakenic

I have a python code of 1000 LOC that I am happy to share.

It uses a client with GUI and a server. Upon user.__button_click(), the client sends a request to the server via socket and prints label text in real time on the program state. The server receives the request and then there is a back-and-forth between server and client, based on the kind of request. The server reacts on a request in the server.__serve_client() routine. The communication is with python socket.socket, .connect() and .listen(1) .

Naturally, I put the following python code around user.__button_click() and server.__serve_client() from above:

def run_function_with_timelimit(function,arguments,max_wait,default_value):
    try: return func_timeout.func_timeout(max_wait,function,args=arguments)
    except func_timeout.FunctionTimedOut: print("took too long")
    except Exception as e: print(f"error occured: {e}.")
    return default_value

Now nothing works anymore. Particularly, both the server and client repeatedly wait for 10 seconds and then print "took too long".

If you want to help me, point me to where I shall send you my code. Alternatively, I am happy for any instructions in this place on how to fix the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions