Error flake8 E901

flake8 xxx --ignore=E501,E128,E701,E261,E301,E126,E127,E131

xxx.py:1:40: E901 SyntaxError: invalid syntax

Does anyone know where the syntax error is?

Python == 2.6, the first line of the file, without marking the byte order:

from __future__ import absolute_import

Works well in Python 2.7 and 3+, though.

+4
source share
2 answers

It's a little hard to guess without a complete file, ideally in some format that accurately stores bytes.

:1:40 refers to the first line, char position 40. Line length - 38 characters.

Thus, suspicion falls on the newline marker.

Most likely, a new line (single char) is not recognized, and Python (not flake8 btw) processes this line and the next and one long line. So the error is in column 40.

2 , char .

, .

+1

--show-source flake8, .

+3

Source: https://habr.com/ru/post/1535154/


All Articles