Skip to content Skip to sidebar Skip to footer

Python2.7 Vs Python3.4 Socket.send

I have the following python socket client. Which sends a small message to a socket server. In Python2.7 this works without flaw. However in 3.4 I get the following Traceback. Has t

Solution 1:

Change

sockobj.send(line)

to

sockobj.send(line.encode())

In Python 3.x send works on bytes not str. Or we could say, Python 3.x rightly(my opinion) ceased to coerce str -> bytes.


Post a Comment for "Python2.7 Vs Python3.4 Socket.send"