From 72ad11c9ee7927b49c1eeca4033e26aa3ecb5e07 Mon Sep 17 00:00:00 2001 From: Roderik Ploszek Date: Sun, 18 Feb 2018 17:28:25 +0100 Subject: [PATCH] Python 3 sgmllib fix sgmllib is deprecated in Python 3, it was replaced by html.parser --- pysollib/htmllib2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pysollib/htmllib2.py b/pysollib/htmllib2.py index 17e02cfb..fd45ffe9 100644 --- a/pysollib/htmllib2.py +++ b/pysollib/htmllib2.py @@ -4,18 +4,18 @@ See the HTML 2.0 specification: http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html """ -import sgmllib +import html.parser as htmllib from formatter import AS_IS __all__ = ["HTMLParser", "HTMLParseError"] -class HTMLParseError(sgmllib.SGMLParseError): +class HTMLParseError(RuntimeError): """Error raised when an HTML document can't be parsed.""" -class HTMLParser(sgmllib.SGMLParser): +class HTMLParser(htmllib.HTMLParser): """This is the basic HTML parser class. It supports all entity names required by the XHTML 1.0 Recommendation. @@ -33,14 +33,14 @@ class HTMLParser(sgmllib.SGMLParser): the parser. """ - sgmllib.SGMLParser.__init__(self, verbose) + htmllib.HTMLParser.__init__(self) self.formatter = formatter def error(self, message): raise HTMLParseError(message) def reset(self): - sgmllib.SGMLParser.reset(self) + htmllib.HTMLParser.reset(self) self.savedata = None self.isindex = 0 self.title = None