tags: python TypeError: an integer is required ( socket.send()
Traceback (most recent call last): File “F:/python/automatic/tsTserv.py”, line 18, in tcpCliSock.send(time,data)
TypeError: an integer is required (got type bytes)
import socket
import time
HOST = ''
PORT = 21568
BUFSIZ = 1024
ADDR = (HOST,PORT)
tcpSerSock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)
while True:
print('waiting for connection')
tcpCliSock,addr = tcpSerSock.accept()
print('...connected form:',addr,tcpCliSock)
while True:
data = tcpCliSock.recv(BUFSIZ)
if not data:
break
**tcpCliSock.send(bytes(time.ctime(), encoding='utf-8'),data)**
tcpCliSock.close()
tcpSerSock.close()
Using Python 3.6 or above to use pyinstaller for packaging will result in a TypeError: an integer is required (got type bytes) exception. The solution and installation pyinstaller tutorial are as foll...
I must record this problem, because I have gone too much road, spend too much time! Problem Description: When the brother's project is placed on his computer, no module name 'error appears, after seve...
When importing the Sklearn library, encounter TypeError: an integer is required (got type bytes) First check your Sklearn version, when you install Sklearn, if you use the following PIP command, you m...
Code: An error was encountered when opening files The following code changes to solve the problem The specific reasons unknown, seeking answers to big brother...
Problems encountered in debugging code today TypeError: an integer is required (got type str) problem causes In the open function of the open file object in python3, the following is the wrong way of ...
This is type alone What is needed is an int type, but input is a STR type ...
TypeError: an integer is required (got type is tuple), This error. To understand it literally, you need to obtain a integer data, and the original code is the tuple. What needs to be done is to change...
.pycharm_helpers/third_party/thriftpy/_shaded_thriftpy/_compat.py Use the following code to replace the original file code...
This machine environment: spark2.4.4, MINICONDA's latest Python 3.9 Run bin/pyspark Times wrong as follows: When it is said on the Internet, Spark is not so friendly for the latest Python version. It ...