Issue 27087: unable to use socket send and sendall due to type error (original) (raw)

import socket # Import socket module s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(hostname,port) # this works message = 'text' s.sendall(message) TypeError: a bytes-like object is required, not 'str'

s.sendall(message)

TypeError: a bytes-like object is required, not 'str'