#!/usr/bin/env python3
"""Checks a chart page made from template.html: python check_html.py chart.html
Prints OK or the first problem found (exit code 1)."""
import json
import re
import sys
def fail(msg: str) -> None:
print("ERROR: " + msg); sys.exit(1)
if len(sys.argv) != 2:
fail("usage: python check_html.py chart.html")
html = open(sys.argv[1], encoding="utf-8").read()
m = re.search(r'', html, re.S)
if not m:
fail('JSON block