handle exceptions from read in is_html_document - python 3 throws an exception but 2 does not