-
Notifications
You must be signed in to change notification settings - Fork 23
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
Specify encoding in open #296
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with these changes, but they won't fix the error you're seeing locally when you run flake8 on python/typeshed#8879! To fix that error, you need to add encoding="utf-8"
to the call to read_text
here:
Line 1777 in c55a904
stublines = path.read_text().splitlines() |
Wanna do that in this PR as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Want to add a changelog entry? This counts as a bugfix. (Feel free to give yourself credit in the entry.)
Are there guidelines on how to do so? |
No, we don't have guidelines for that yet -- I can write something up :) But basically the process is "add a short sentence to the top of the changelog describing the user-visible impact of the change". For now, this is is a pretty good example of a bugfix changelog entry: https://github.com/PyCQA/flake8-pyi/pull/193/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R6 And this is a pretty good example of a changelog entry from a non-maintainer contributor: https://github.com/PyCQA/flake8-pyi/pull/242/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR20-R21 |
…-pyi into UnicodeDecodeError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna pretend I know what a non-CP1252 character is
Thanks! :D |
See https://peps.python.org/pep-0597/
This also happened to me on Windows in python/typeshed#8879 because of mathematical unicode characters as part of the comments:
There are linters to catch this, namely pylint (unspecified-encoding), flake8-encodings and flake8-file-encoding. I have tried both flake8 plugins mentioned and they gave me the same results, other than slightly different error messages: