Specify output_file encoding as utf-8#364
Merged
Merged
Conversation
ericwb
requested changes
Aug 14, 2018
| parser.add_argument( | ||
| '-o', '--output', dest='output_file', action='store', nargs='?', | ||
| type=argparse.FileType('w'), default=sys.stdout, | ||
| type=argparse.FileType('w', encoding='utf-8'), default=sys.stdout, |
Member
There was a problem hiding this comment.
The encoding parameter wasn't added until Py3.4, but we still want to support Py2.7 at this point.
https://docs.python.org/3/library/argparse.html#filetype-objects
|
Is python 2.7 support still required for bandit now that python 2.7 itself is no longer supported? I see some discussion of this on #500 but it doesn't seem resolved yet. The #362 bug that this PR would fix is the first thing I hit while trying out bandit for the first time on a Windows project using python 3.7. We could look to make this fix py2 compatible as well, but if py2 support is to be dropped, there would be no gain from that complication. |
Member
ericwb
approved these changes
Dec 14, 2020
Member
ericwb
left a comment
There was a problem hiding this comment.
Now that we have dropped py2.7, this fix is applicable.
mikespallino
pushed a commit
to mikespallino/bandit
that referenced
this pull request
Aug 25, 2021
Co-authored-by: Eric Brown <ericwb@users.noreply.github.com> Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
mikespallino
pushed a commit
to mikespallino/bandit
that referenced
this pull request
Jan 7, 2022
Co-authored-by: Eric Brown <ericwb@users.noreply.github.com> Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
This was referenced Jan 25, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #362