- with open(html_output_path, "w") as f:
- f.write(html_template.format(
- location_total, location_covered, location_percent,
- arb_total, arb_covered, arb_percent,
- objects_total, objects_covered, objects_percent,
- hints_total, hints_covered, hints_percent,
- class_total, class_covered, class_percent,
- turn_total, turn_covered, turn_percent,
- obituaries_total, obituaries_covered, obituaries_percent,
- actions_total, actions_covered, actions_percent,
- special_total, special_covered, special_percent,
- location_html, arb_msg_html, object_html, hints_html,
- class_html, turn_html, obituaries_html, actions_html, special_html
- ))
+ try:
+ with open(HTML_TEMPLATE_PATH, "r") as f:
+ # read in HTML template
+ html_template = f.read()
+ except IOError as e:
+ print 'ERROR: reading HTML report template failed (%s)' % e.strerror
+ exit(-1)
+
+ # parse template with report and write it out
+ try:
+ with open(html_output_path, "w") as f:
+ f.write(html_template.format(categories=categories_html, summary=summary_html))
+ except IOError as e:
+ print 'ERROR: writing HTML report failed (%s)' % e.strerror