Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0x80 in position 3131: invalid start byte solution

The Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0x80 in position 3131: invalid start byte appears in the process of using Python 3 to read files on Mac OS.

The reason is: OS X system has hidden file. DS in the folder_ Store file, affecting the file read.

.DS_ Store is a hidden file that stores the custom properties of a folder on Mac OS, such as its icon location or background color.

The solution is: use the command line to enter the folder where the file is read and delete. DS_ Store file.

1. Use the command LS – A to view. DS_ Store file

2. rm .DS_ Store。

 

Read More: