A line like
print("foo", end=" ")
is reported as E901 SyntaxError: invalid syntax
invalid syntax by flake8
.
pep8
doesn't complain but flake8
does even though flake8
uses pep8
.
I wonder if that means the problem is with pyflakes
(which flake8
also uses).
Note that the line is a SyntaxError
in Python 2.
pyflakes
gives the error, so flake8
is almost certainly getting it from there not pep8
.
Maybe the solution is to get rid of pyflakes
(and the rest of flake8
) from the global site-packages.
It appears Atom Editor will use the right Python version to run flake8
if it is started up in the virtualenv (otherwise, after you remove flake8
from the global site-packages, Atom will complain that flake8
doesn't exist.
One thing I haven't tested yet is starting up two Atom windows, one from a Python 2 virtualenv and one from a Python 3 virtualenv.
Okay, so I've tested that now. It appears multiple Atom windows will use the flake8
in the virtualenv where Atom was first started up.
It also means that if you start up Atom from somewhere other than atom
on the command line (in a virtualenv) flake8
won't be available.
In summary, if you develop with both Python 2 and Python 3 and want to use flake8
:
flake8
at global site-packages levelflake8
support, always start up atom
from within the virtual environment