Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This plugin fails to parse files with unicode on windows #10

Closed
sobolevn opened this issue Mar 1, 2019 · 3 comments
Closed

This plugin fails to parse files with unicode on windows #10

sobolevn opened this issue Mar 1, 2019 · 3 comments

Comments

@sobolevn
Copy link

sobolevn commented Mar 1, 2019

Reproduction steps:

  1. Use windows
  2. Install flake8-bandit
  3. Create a python file with print('Привет, бандиты!') unicode contents
  4. Try to run flake8 your_file.py

It will fail with something like this:

c:\users\appveyor\appdata\local\pypoetry\cache\virtualenvs\wemake-python-styleguide-py3.6\lib\site-packages\flake8\checker.py:451: in run_check
    return plugin["plugin"](**arguments)
c:\users\appveyor\appdata\local\pypoetry\cache\virtualenvs\wemake-python-styleguide-py3.6\lib\site-packages\flake8_bandit.py:35: in __init__
    self._load_source()
c:\users\appveyor\appdata\local\pypoetry\cache\virtualenvs\wemake-python-styleguide-py3.6\lib\site-packages\flake8_bandit.py:73: in _load_source
    self.source = f.read()
C:\Python36\lib\encodings\cp1252.py:23: in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
E   UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 14170: character maps to <undefined>

Original issue: wemake-services/wemake-python-styleguide#337
Log: https://ci.appveyor.com/project/wemake-services/wemake-python-styleguide/build/job/185lp386ce91jtsy

@tylerwince
Copy link
Owner

This is something that I need to work on for sure -- I will potentially have some time in the coming weeks but would welcome a PR if you want to take a stab at it

@gdude2002
Copy link

I'm not sure when exactly this was fixed, but it does appear to no longer be a problem on the latest version.

@tylerwince
Copy link
Owner

Awesome! Not sure who fixed it, but probably wasn't me 😆

Let me know if you see it again @gdude2002

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

No branches or pull requests

3 participants