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