schemato icon indicating copy to clipboard operation
schemato copied to clipboard

HTMLParseError was deprecated in Py3

Open ghost opened this issue 7 years ago • 2 comments

There's a line attempting to import HTMLParseError here which results in schemato being unimportable in Python3:

In [1]: import schemato
INFO:rdflib:RDFLib Version: 4.2.1
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-3210cda68f48> in <module>()
----> 1 import schemato

/usr/local/lib/python3.5/dist-packages/schemato/__init__.py in <module>()
      1 from __future__ import absolute_import
      2 
----> 3 from .schemato import Schemato
      4 
      5 

/usr/local/lib/python3.5/dist-packages/schemato/schemato.py in <module>()
      8 
      9 from .compound_graph import CompoundGraph
---> 10 from .schemas.parselypage import ParselyPageValidator
     11 
     12 

/usr/local/lib/python3.5/dist-packages/schemato/schemas/parselypage.py in <module>()
      5 from six import StringIO, iteritems
      6 from six.moves.urllib.request import urlopen
----> 7 from six.moves.html_parser import HTMLParser, HTMLParseError
      8 
      9 from ..errors import _error

ImportError: cannot import name 'HTMLParseError'

This occurs because while six.moves makes html_parser available, the Python3 target no longer supports HTMLParseError.

It appears only to be raised from one function; probably a custom exception would suffice.

It's a small change but if you're short on time I'm happy to offer a PR?

ghost avatar Sep 01 '16 19:09 ghost