tags: Python
TypeError: an integer is required (got type str)
In the open function of the open file object in python3, the following is the wrong way of writing
read_helper=open(checkpath,"r","utf-8")
For the third parameter, encoding="utf-8" must be added to specify the encoding method
read_helper=open(checkpath,"r",encoding="utf-8")
If encoding= is not added, the interpreter assumes that the third parameter is the specified buffering, and this variable itself needs to be passed in an integer variable.
def open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True):

For the binary reading mode, the encoding method cannot be formulated, and the correct writing method is as follows
read_helper=open(checkpath,"rb")
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 ...
python: Use PyInstaller packaged into exe files, and TypeError: an integer is required (got type bytes) exception resolution 2019-11-12 15:50:22 lad. Read the article tag number 225: python package ex...
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...
Pack Python files into an exe command: pyinstaller -f -w xxx.pyWhen the results are compiled, an error is not generated without generating an EXE file. solve PyInstaller -F -w .\xxx.pySuccessfully gen...
Python packs into an EXE file First, you need to install the Pyinstaller library, then enter the target file directory, enter the command line package PY file, but an error occurred:TypeError: an inte...
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 ...
TypeError: an integer is required (got type tuple) RandomResizedCrop Labels (space separated):pytorch This error may be caused by the version, but I did not find a solution on the Internet, and I foun...
There is a sample code in the first section of Chapter 12 of "Python Programming" published by Tsinghua University Press, [Example 12-1] Display the hello world on the graphical interface (S...
The PyTorch version in the experimental environment is 0.4.1, and the Torchvision version is 0.2.1. (This version looks familiar, is it cooked?) Error: Because there is a mistake in errorstorch.transf...
TypeError: an integer is required (got type bytes) error correction method of seeking correction Traceback (most recent call last): File “F:/python/automatic/tsTserv.py”, line 18, in tcpCl...