*emphasized text*C:\Users\jjh89\AppData\Local\Programs\Python\Python36\python.exe C:/Users/jjh89/PycharmProjects/untitled/client.py
connected server!
input sachick(q to quit, 0 to initialize) : 2 + 5
Traceback (most recent call last):
File "C:/Users/jjh89/PycharmProjects/untitled/client.py", line 13, in s.sendall(message)
TypeError: a bytes-like object is required, not 'str'
Process finished with exit code 1
This error occurs
s.sendall(message)
print(s.recv(1000))
The 13th line is as follows The source has a server, and the client sends an operator and an operand to calculate the sum I'm implementing getting it back, but it's blocked over there
print(message)
conn.sendall(message)
The server side looks like this Please give me a solution
python
If you look at sendall's specification, sendall receives string as a parameter in python2.
However, in python3, sendall is a problem that occurred because it received bytes.
Try replacing it with s.sendall(message.code()
.
© 2024 OneMinuteCode. All rights reserved.