def write_html_report(results_dir, report_path=None, encoding='utf8'):
 default_report_path = os.path.join(results_dir, 'job_report.html')
 if (report_path is None):
  report_path = default_report_path
 relative_links = True
 if (report_path != default_report_path):
  relative_links = False
 rendered_html = generate_html_report(results_dir, relative_links)
 report_dir = os.path.dirname(report_path)
 if (not os.path.isdir(report_dir)):
  raise InvalidOutputDirError(report_dir)
 html_result = open(report_path, 'w')
 html_result.write(rendered_html.encode(encoding))
 html_result.close()
 logging.info('Report successfully generated at %s', report_path)

def write_html_report ( results_dir , report_path = None , encoding = 'utf8' ) : default_report_path = os . path . join ( results_dir , 'job_report.html' ) if ( report_path is None ) : report_path = default_report_path relative_links = True if ( report_path != default_report_path ) : relative_links = False rendered_html = generate_html_report ( results_dir , relative_links ) report_dir = os . path . dirname ( report_path ) if ( not os . path . isdir ( report_dir ) ) : raise InvalidOutputDirError ( report_dir ) html_result = open ( report_path , 'w' ) html_result . write ( rendered_html . encode ( encoding ) ) html_result . close ( ) logging . info ( 'Report successfully generated at %s' , report_path )
write an html file at report_path .