Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Can't save report to a file #123

Open
wiredaem0n opened this issue Dec 15, 2017 · 3 comments
Open

Can't save report to a file #123

wiredaem0n opened this issue Dec 15, 2017 · 3 comments
Labels
Milestone

Comments

@wiredaem0n
Copy link

Getting the following error when trying to save report to a file. Note that running the report without redirecting the output to a file works.

# oscapd-cli result 1 1 report > sample-report.html Traceback (most recent call last): File "/bin/oscapd-cli", line 846, in <module> main() File "/bin/oscapd-cli", line 838, in main cli_result(dbus_iface, args) File "/bin/oscapd-cli", line 466, in cli_result print(report) UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 223106: ordinal not in range(128)

@wiredaem0n wiredaem0n changed the title Can't save report Can't save report to a file Dec 15, 2017
@matejak
Copy link
Contributor

matejak commented Jan 16, 2018

It is a somewhat tricky issue - Python doesn't know the encoding of the file you are trying to write, and this is a problem for python2. Although it can be fixed in a smarter way, you can try this quick fix:
PYTHONIOENCODING=UTF-8 oscapd-cli result 1 1 report > sample-report.html

@matejak matejak added this to the 0.1.11 milestone Feb 8, 2018
@matejak matejak added the bug label Feb 8, 2018
@matejak
Copy link
Contributor

matejak commented Feb 8, 2018

I think that as we write an HTML file, we know that we use the UTF8 encoding, so it should be fixed in the code.

@tuxmaster
Copy link

Workaround: see EPEL Bugzilla

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants