From 0b5298f94839821c429a9b6f6c8b728edfd2edb7 Mon Sep 17 00:00:00 2001 From: Roderik Ploszek Date: Mon, 19 Feb 2018 13:31:16 +0100 Subject: [PATCH] Fix compatibility with python 2 tests There are still tests that use python 2, which doesn't have html.parser. In that case a correct name of the module is imported. --- pysollib/htmllib2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pysollib/htmllib2.py b/pysollib/htmllib2.py index 3e42e738..5882666e 100644 --- a/pysollib/htmllib2.py +++ b/pysollib/htmllib2.py @@ -4,7 +4,11 @@ See the HTML 2.0 specification: http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html """ -import html.parser as htmllib +try: + import html.parser as htmllib +except ImportError: + # For Python 2 tests compatibility + import HTMLParser as htmllib from formatter import AS_IS