Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

UnicodeEncodeError when path contains non-ascii characters #603

Closed
cbrnr opened this issue May 16, 2018 · 0 comments
Closed

UnicodeEncodeError when path contains non-ascii characters #603

cbrnr opened this issue May 16, 2018 · 0 comments

Comments

@cbrnr
Copy link

cbrnr commented May 16, 2018

Whenever the path (which includes the file name) contains a non-ascii character (e.g. the German ü), I get a warning message in Atom, which is caused by a UnicodeEncodeError in flake8:

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/python3.6/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/usr/local/lib/python3.6/site-packages/flake8/main/application.py", line 396, in run
    self._run(argv)
  File "/usr/local/lib/python3.6/site-packages/flake8/main/application.py", line 385, in _run
    self.report()
  File "/usr/local/lib/python3.6/site-packages/flake8/main/application.py", line 376, in report
    self.report_errors()
  File "/usr/local/lib/python3.6/site-packages/flake8/main/application.py", line 340, in report_errors
    results = self.file_checker_manager.report()
  File "/usr/local/lib/python3.6/site-packages/flake8/checker.py", line 267, in report
    results_reported += self._handle_results(filename, results)
  File "/usr/local/lib/python3.6/site-packages/flake8/checker.py", line 166, in _handle_results
    physical_line=physical_line,
  File "/usr/local/lib/python3.6/site-packages/flake8/style_guide.py", line 392, in handle_error
    self.formatter.handle(error)
  File "/usr/local/lib/python3.6/site-packages/flake8/formatting/base.py", line 88, in handle
    self.write(line, source)
  File "/usr/local/lib/python3.6/site-packages/flake8/formatting/base.py", line 191, in write
    self._write(line)
  File "/usr/local/lib/python3.6/site-packages/flake8/formatting/base.py", line 175, in _write
    print(output)
UnicodeEncodeError: 'ascii' codec can't encode character '\u0308' in position 24: ordinal not in range(128)

This error disappears if I remove the non-ascii characters from the file name/path.

I've already created an issue at https://gitlab.com/pycqa/flake8/issues/420, but I feel this is an issue of linter-flake8 because this works if I use flake8 from the command line. @sigmavirus24 commented that it might have to do with non-matching locales. Please let me know if you need further information.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant