For example, my error is shown in the following figure:

GBK encoder cannot decode byte 0x80 at position 20: illegal multi-byte sequence.

Using the error message, we find the py file where the code resides:

The encoding format is not specified when the file is opened with open. GBK is used by default, so this error occurs.

Solution: Specify utF-8 encoding for open() :

Perfect solution!