tags: Python notes socket tcp/ip websocket reptile
TypeError: an integer is required (got type str)
Traceback (most recent call last):
File "F:\py\demo.py", line 13, in <module>
s.connect((host,port))
TypeError: an integer is required (got type str)
You can see that the Python prompts to connect, and the error isan integer is required (got type str)
Then I saw my code.
host=sys.argv[1]
port=sys.argv[2] #
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((host,port))
It is only necessary to transfer the parameters passed by the port (port) to int. After the change is finished.
host=sys.argv[1]
port=int(sys.argv[2]) #
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((host,port))
problem solved.
Problem background The blogger’s version of pytorch is 0.4.1, and the version of torchvision is 0.2.1, an error occurs when the following code is executed. See the error below: Question inquiry ...
Framed the face on the picture, the following error appeared: Haven't encountered it before, instackoverflowI found the explanation above, which is the reason why the image read by PIL.Image cannot us...
It is really not easy to use OpenCV, always give you a surprise. If you are in the picture, your error is as follows: cv2.rectangle(src, (20, 20), (100, 100), (200, 0, 0), 1) TypeError: an integer is ...
Announcement TypeError: An Integer Is Required (Got Type Tuple) The above operation, will occupy too much memory, operate with np.stack ((IM_B, IM_G, IM_R), AXIS = 2)...
Linux [Ubuntu, other versions are for reference only] Run the Pyspark program in Jupyter Notebook error, query information discovery, current2020.11.18Pyspark still does not support higher version of ...
Original address: I am currently learning Python basic grammar and computer network lessons, so I just learned python network programming, see the third edition of "Python Core Programming",...
"Python core programming," third edition, found Example 2-1 returns an error code that tangled for a long time ... .. Python2.7 find here python3.5 socket and return the decoded value are di...
STR can be compiled into the specified Byte by eNCode () Byte can be compiled into a specified STR through decode () There is an error in the Python network programming: TypeError: a bytes-like object...
Use pyinstaller Installation command: pip install pyinstaller or pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz The second recommended: because I just started using the ...
reference:TypeError: unicode argument expected, got 'str' Python code: Interpreter error: Explanation of this question on stackoverflow is: io.StringIO is confusing in Python 2.7 because it's backport...