Python sockets error TypeError: a bytes-like object is required, not ‘str’ with send function

The reason for this error is that in Python 3, strings are Unicode, but when transmitting on the network, the data needs to be bytes instead. So… a couple of suggestions: Suggest using c.sendall() instead of c.send() to prevent possible issues where you may not have sent the entire msg with one call (see docs). For literals, add a ‘b’ for bytes … Read more