bandit
bandit copied to clipboard
Runtime error with screen/text formating
Describe the bug I am scanning many repositories with a single command
bandit -v -ii -lll -r ./
and I get this result:

Same happens with this command:
bandit -f txt-v -ii -lll -r ./

To Reproduce Steps to reproduce the behavior: Not sure how to reproduce to be honest. :D Maybe just do as I did scan a lot of repositories using the default output.
Expected behavior Normally I would expect a normal issue report.
Bandit version
1.5.1
Additional context macOs Mojave version 10.14.3
I installed Bandit for python3 and again I get this:

with this command:
bandit -v -ii -lll -r ./
Is this within a screen session? It seems to be some issues with unicode rendering.
I'm getting a similar issue using Git Bash on Windows 10. With Python 3.7.3 and Release 1.6.2 of bandit.
File "<me>\AppData\Roaming\Python\Python37\site-packages\bandit\core\manager.py", line 173, in output_results "%s" % (output_format, str(e)))
RuntimeError: Unable to output report using 'txt' formatter: 'charmap' codec can't encode character '\u0130' in position 155969: character maps to <undefined>
I also ran this on Ubuntu 18.04LTS (WSL) with Python 3.7.5 and it seemed to work fine.
Interestingly.... this works just fine in powershell. So, there's a workaround for anyone on Windows running into the same problem.
We will need the python code Bandit was run against in order to duplicate and resolve. At this point, I can't reproduce.