Skip to content

Commit

Permalink
Fix import problem
Browse files Browse the repository at this point in the history
No module named 'json2html'
  • Loading branch information
Honny1 committed Jan 15, 2024
1 parent fd0ce5d commit 36fc0e0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion utils/profile_tool/stats.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import os
import json
from json2html import json2html

from ssg.build_profile import XCCDFBenchmark
from ssg.utils import mkdir_p


OFF_JSON_TO_HTML = False

try:
from json2html import json2html
except ImportError:
OFF_JSON_TO_HTML = True


def _process_stats_content(profile, bash_fixes_count, content, content_filepath):
link = """<a href="{}"><div style="height:100%;width:100%">{}</div></a>"""
count = len(profile[content])
Expand Down Expand Up @@ -98,6 +105,9 @@ def command_stats(args):
print(json.dumps(profiles, indent=4))

elif args.format == "html":
if OFF_JSON_TO_HTML:
print("No module named 'json2html'. Please install module to enable this function.")
return
_generate_html_stats(args, profiles)

elif args.format == "csv":
Expand Down

0 comments on commit 36fc0e0

Please sign in to comment.