diff --git a/utils/profile_tool/stats.py b/utils/profile_tool/stats.py index a3ff5a026e6..55ce6493f3e 100644 --- a/utils/profile_tool/stats.py +++ b/utils/profile_tool/stats.py @@ -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 = """
{}
""" count = len(profile[content]) @@ -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":