linter-flake8
linter-flake8 copied to clipboard
flake8 crashes, unknown encoding with python file
when saving a simple python file with atom, flake 8 crashes (works with the command line though).
I'm on OSX, flake8 installed with pip install flake8
. I'm using the latest versions of atom and linter-flake8.
here´s the error message ...
linter-flake8:: Flake8 returned an error Traceback (most recent call last):
File "/usr/local/bin/flake8", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/flake8/main/cli.py", line 16, in main
app.run(argv)
File "/usr/local/lib/python2.7/site-packages/flake8/main/application.py", line 348, in run
self._run(argv)
File "/usr/local/lib/python2.7/site-packages/flake8/main/application.py", line 335, in _run
self.initialize(argv)
File "/usr/local/lib/python2.7/site-packages/flake8/main/application.py", line 319, in initialize
self.parse_configuration_and_cli(argv)
File "/usr/local/lib/python2.7/site-packages/flake8/main/application.py", line 168, in parse_configuration_and_cli
self.option_manager, argv
File "/usr/local/lib/python2.7/site-packages/flake8/options/aggregator.py", line 47, in aggregate_options
original_values.isolated)
File "/usr/local/lib/python2.7/site-packages/flake8/options/config.py", line 282, in parse
return self.merge_user_and_local_config()
File "/usr/local/lib/python2.7/site-packages/flake8/options/config.py", line 246, in merge_user_and_local_config
config = self.parse_local_config()
File "/usr/local/lib/python2.7/site-packages/flake8/options/config.py", line 206, in parse_local_config
config = self.config_finder.local_configs()
File "/usr/local/lib/python2.7/site-packages/flake8/options/config.py", line 107, in local_configs
config, found_files = self._read_config(self.local_config_files())
File "/usr/local/lib/python2.7/site-packages/flake8/options/config.py", line 56, in _read_config
found_files = config.read(files)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/backports/configparser/__init__.py", line 704, in read
with open(filename, encoding=encoding) as fp:
LookupError: unknown encoding:
It seems to come down to line 56 in flake8/options/config.py
. If I change that line from
found_files = config.read(files)
to
found_files = config.read(files, encoding="UTF-8")
everything works fine.
Therefore, I'm not sure this issue is related to linter-flake8. But it´s still weird that flake8 works from the command line.
I've just seen a similar error, and it was being caused by a flake8 plugin, not flake8 or linter-flake8. For anyone encountering this it's worth checking your plugins.
@sehmaschine , and @danpalmer your problem will be fixed after following my steps in this link; Fix-Linter-flak8.