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:
- ERROR: invalid byte sequence for encoding “UTF8”: 0x00
- Python: print syntax error: problem with invalid syntax error
- Python2.7 IOError: [Errno 0] Error when the cmd encoding is utf-8
- Lookuperror: unknown encoding: cp65001 when executing Python
- Solve the problem of syntax error: invalid syntax in PIP install XXX
- Syntax error: invalid syntax before Python string
- Solve the problem of syntax error: unexpected end of file or syntax error near unexpected token ` fi ‘error
- Syntax error: unexpected end of file problem [two solutions]
- Solve the problem of shell script “syntax error near unexpected token `fi’”.
- Solve the problem of unable to locate package python3.6 when upgrading from python3.5 to python3.6 in ubantu16.04
- syntax error near unexpected token `then’ problem solution
- Solve the Java “syntax error on token enum” problem
- Docker machine install syntax error near unexpected token ‘newline’! DOCTYPE HTML problem resolution
- CentOS solves the problem of modulenotfounderror when salt calls python3 script remotely, and solves the problem that PIP3 module cannot be shared by different users
- original_keras_version = f.attrs[‘keras_version‘].decode(‘utf8‘) AttributeError: ‘str‘ object has
- Encountered a problem — Python — Python 3 uses Sqlalchemy to report an error‘
- Solving Linux minute warning: no support for locale: en_ US.utf
- Error syntax error: invalid syntax in PIP install XXX
- Java prompt unmappable character for encoding solution