Python error: syntax error: encoding problem: utf8

Python error: syntax error: encoding problem: utf8

Such as the title.
The first line reported an error, but I have checked the file code, it is indeed utf8.
At this point, use Notepad + + to open the file, and you can see the newline style of the file at the bottom right. (CR LF is windows style, LF is UNIX style)

so I found that the original. Py file is UNIX newline style, because I pulled it from GitHub, and the original author’s environment is probably UNIX.
So the. Py file can be converted to a Windows style line feed.

finish

Read More: