Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulator.py/RpcHandler() needs encode/decode to work these days #173

Open
kiml opened this issue Sep 20, 2022 · 1 comment
Open

simulator.py/RpcHandler() needs encode/decode to work these days #173

kiml opened this issue Sep 20, 2022 · 1 comment

Comments

@kiml
Copy link

kiml commented Sep 20, 2022

I needed to make the following change (Python 3.9) to make this code work.

@@ -90,13 +90,13 @@ class RpcHandler(SocketServer.BaseRequestHandler):
"""This function is called automatically by the SocketServer"""
# self.request is the TCP socket connected to the client
# read the incoming command

  •    request = self.request.recv(1024).strip()
    
  •    request = self.request.recv(1024).decode().strip()
       # write to the queue waiting to be processed by the server
       INPUT_QUEUE.put(request)
       # wait for the server answer in the output queue
       response = OUTPUT_QUEUE.get(timeout=5.0)
       # send back the answer
    
  •    self.request.send(response)
    
  •    self.request.send(response.encode())
    
@ljean
Copy link
Owner

ljean commented Sep 28, 2022

Hello, thanks for proposal. Can you please make a PR with this code. Is it still works in prior version of Python 3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants