You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NB:Using branchmain(specifically, version1.7.5.dev60) instead of version1.7.4resolves this issue. Please read below, including theAdditional context section.
Similar to Issue #362, fixed in PR #364, bandit does not decode Unicode on Windows since Windows defaults to cp1252 encoding.
This was first noticed when using commitizen with emojis in a pyproject.toml and running pre-commit. The corresponding repo can be found here:
Feel free to close this as "to be resolved in future version", or something similarly appropriate, if applicable. Also feel free to incorporate in CHANGELOG for next revision, if applicable.
Describe the bug
NB: Using branch
main
(specifically, version1.7.5.dev60
) instead of version1.7.4
resolves this issue. Please read below, including theAdditional context
section.Similar to Issue #362, fixed in PR #364,
bandit
does not decode Unicode on Windows since Windows defaults tocp1252
encoding.This was first noticed when using
commitizen
with emojis in apyproject.toml
and runningpre-commit
. The corresponding repo can be found here:https://github.com/adam-grant-hendry/qtpygraph
pyproject.toml
Reproduction steps
pyproject.toml
with emojis as shown (seeDescribe the bug
) and install the projectPS> poetry install
pre-commit
Expected behavior
pre-commit
is able to run withbandit
hook withoutUnicodeDecodeError
sActual Behavior
bandit
emits aUnicodeDecodeError
:Bandit version
1.7.4 (Default)
Python version
3.8
Additional context
OS:
Windows 10, 21H2
Python:
3.8.10, x64-bit
poetry:
1.2.2
Following the stack trace,
bandit==1.7.4
does not specify an encoding when usingopen
:bandit/bandit/core/config.py
Lines 35 to 37 in 1ed7906
However, the
main
branch has been updated to use read binary mode (open
does not support encodings when reading in binary mode):bandit/bandit/core/config.py
Lines 39 to 41 in 3aaa2b0
The text was updated successfully, but these errors were encountered: