RuntimeError

Bug #1647925 reported by visual
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bandit
Fix Released
Medium
Tim Kelsey

Bug Description

ubuntu@VM-231-184-ubuntu:~$ bandit -r /
[main] INFO profile include tests: None
[main] INFO profile exclude tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: None
[main] INFO running on Python 2.7.12
3169 [0.. 50.. 100.. 150.. 200.. 250.. 300.. 350.. 400.. 450.. 500.. 550.. 600.. 650.. 700.. 750.. 800.. 850.. 900.. 950.. 1000.. 1050.. 1100.. 1150.. 1200.. 1250.. 1300.. 1350.. 1400.. 1450.. 1500.. 1550.. 1600.. 1650.. 1700.. 1750.. 1800.. 1850.. 1900.. 1950.. 2000.. 2050.. 2100.. 2150.. 2200.. 2250.. 2300.. 2350.. 2400.. 2450.. 2500.. 2550.. 2600.. 2650.. 2700.. 2750.. 2800.. 2850.. 2900.. 2950.. 3000.. 3050.. 3100.. 3150.. ]
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/bandit", line 11, in <module>
    sys.exit(main())
  File "/home/ubuntu/.local/lib/python2.7/site-packages/bandit/cli/main.py", line 345, in main
    args.output_format)
  File "/home/ubuntu/.local/lib/python2.7/site-packages/bandit/core/manager.py", line 151, in output_results
    "%s" % (output_format, str(e)))
RuntimeError: Unable to output report using 'screen' formatter: 'ascii' codec can't encode characters in position 120758-120762: ordinal not in range(128)

I use pip to install bandit, and the version of ubuntu is Ubuntu Server 16.04.1 LTS x64.

Revision history for this message
David Wyde (david-wyde) wrote :

I think I can reproduce with a filename containing non-ASCII characters:

$ python -c 'open(u"\xee.py", "w").write("=")'
$ bandit *.py
[main] INFO profile include tests: None
[main] INFO profile exclude tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: None
[main] INFO running on Python 2.7.10
[node_visitor] INFO Unable to find qualified name for module: î.py
Traceback (most recent call last):
  File "/usr/local/bin/bandit", line 10, in <module>
    sys.exit(main())
  File "/Users/dwyde/code/bandit/bandit/cli/main.py", line 345, in main
    args.output_format)
  File "/Users/dwyde/code/bandit/bandit/core/manager.py", line 151, in output_results
    "%s" % (output_format, str(e)))
RuntimeError: Unable to output report using 'screen' formatter: 'ascii' codec can't decode byte 0xcc in position 2: ordinal not in range(128)

Revision history for this message
Travis McPeak (travis-mcpeak) wrote :

Arggg! Non-ascii chars again :( Ian - can you suggest something here?

Changed in bandit:
importance: Undecided → Medium
Tim Kelsey (tim-kelsey)
Changed in bandit:
assignee: nobody → Tim Kelsey (tim-kelsey)
Revision history for this message
Tim Kelsey (tim-kelsey) wrote :
Changed in bandit:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to bandit (master)

Reviewed: https://review.openstack.org/417453
Committed: https://git.openstack.org/cgit/openstack/bandit/commit/?id=17c737a391f5f8b1f41d77a40da4429d739e09f5
Submitter: Jenkins
Branch: master

commit 17c737a391f5f8b1f41d77a40da4429d739e09f5
Author: Timothy Kelsey <email address hidden>
Date: Fri Jan 6 17:22:33 2017 +0000

    Fixing some UTF8 encoding issues in file names

    The names of skipped files were not being encoded properly in
    output reports.

    Change-Id: I38055512d71b3268b5241d50f1aa01a4b28ed332
    Closes-Bug: #1647925

Changed in bandit:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.