diff --git a/garak/analyze/report_digest.py b/garak/analyze/report_digest.py index 72214d14..1ccf144d 100644 --- a/garak/analyze/report_digest.py +++ b/garak/analyze/report_digest.py @@ -12,28 +12,27 @@ import jinja2 -from garak import _config, _plugins +from garak import _config -templateLoader = jinja2.FileSystemLoader(searchpath=".") +print(_config.transient.basedir) +templateLoader = jinja2.FileSystemLoader(searchpath=_config.transient.basedir) templateEnv = jinja2.Environment(loader=templateLoader) -header_template = templateEnv.get_template( - "garak/analyze/templates/digest_header.jinja" -) -footer_template = templateEnv.get_template( - "garak/analyze/templates/digest_footer.jinja" -) -group_template = templateEnv.get_template("garak/analyze/templates/digest_group.jinja") -probe_template = templateEnv.get_template("garak/analyze/templates/digest_probe.jinja") -detector_template = templateEnv.get_template( - "garak/analyze/templates/digest_detector.jinja" -) -end_module = templateEnv.get_template("garak/analyze/templates/end_module.jinja") +header_template = templateEnv.get_template("analyze/templates/digest_header.jinja") +footer_template = templateEnv.get_template("analyze/templates/digest_footer.jinja") +group_template = templateEnv.get_template("analyze/templates/digest_group.jinja") +probe_template = templateEnv.get_template("analyze/templates/digest_probe.jinja") +detector_template = templateEnv.get_template("analyze/templates/digest_detector.jinja") +end_module = templateEnv.get_template("analyze/templates/end_module.jinja") misp_descriptions = {} -if os.path.isfile("garak/resources/misp_descriptions.tsv"): - with open("garak/resources/misp_descriptions.tsv", "r", encoding="utf-8") as f: +if os.path.isfile(_config.transient.basedir / "garak/resources/misp_descriptions.tsv"): + with open( + _config.transient.basedir / "garak/resources/misp_descriptions.tsv", + "r", + encoding="utf-8", + ) as f: for line in f: key, title, descr = line.strip().split("\t") misp_descriptions[key] = (title, descr)