Skip to content

UnicodeDecodeError when flake8 config contains unicode characters #148

Closed

Description

From Creston Bunch (@crestonbunch) on July 19, 2017 14:25

Environment data

VS Code version: 1.14.1
Python Extension version: 0.6.7
Python Version: 2.7
OS and version: macOS Sierra 10.12.5

Actual behavior

Linting fails with error. (Note, it does succeed when I try flake8 from the terminal)

Expected behavior

Linting succeeds without error.

Steps to reproduce:

  • Insert unicode character into a flake8 INI config
  • Set python.linting.flake8Enabled: true
  • Set python.linting.flake8Args: ["--config=flake8.cfg"]
  • Run linter/save file

Settings

Your launch.json (if dealing with debugger issues):

Your settings.json:

Logs

Output from Python output panel

##########Linting Output - flake8##########

Traceback (most recent call last):
  File "/usr/local/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 328, in run
    self._run(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 315, in _run
    self.initialize(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 299, in initialize
    self.parse_configuration_and_cli(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 168, in parse_configuration_and_cli
    self.option_manager, argv
  File "/Library/Python/2.7/site-packages/flake8/options/aggregator.py", line 47, in aggregate_options
    original_values.isolated)
  File "/Library/Python/2.7/site-packages/flake8/options/config.py", line 279, in parse
    return self.parse_cli_config(cli_config)
  File "/Library/Python/2.7/site-packages/flake8/options/config.py", line 227, in parse_cli_config
    config = self.config_finder.cli_config(config_path)
  File "/Library/Python/2.7/site-packages/flake8/options/config.py", line 66, in cli_config
    config, found_files = self._read_config(files)
  File "/Library/Python/2.7/site-packages/flake8/options/config.py", line 56, in _read_config
    found_files = config.read(files)
  File "/Library/Python/2.7/site-packages/backports/configparser/__init__.py", line 705, in read
    self._read(fp, filename)
  File "/Library/Python/2.7/site-packages/backports/configparser/__init__.py", line 1035, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 226: ordinal not in range(128)

Output from Console window (Help->Developer Tools menu)

Copied from original issue: DonJayamanne/pythonVSCode#1103

Activity

  1. brettcannon commented on Jan 11, 2018

    @brettcannon
    Member

    I can't reproduce on the latest version of the extension and flake8. Closing as fixed.

  2. locked as resolved and limited conversation to collaborators on Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-lintingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions