-
-
Notifications
You must be signed in to change notification settings - Fork 622
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 output_file encoding as utf-8 #364
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.
Will require a Py2.7 fix.
@@ -215,7 +215,7 @@ def main(): | |||
) | |||
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, |
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.
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. |
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.
Now that we have dropped py2.7, this fix is applicable.
Co-authored-by: Eric Brown <ericwb@users.noreply.github.com> Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
Co-authored-by: Eric Brown <ericwb@users.noreply.github.com> Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
Fixes #362