Linter fails in Python 3.5.0
- Dominant language
- Python
- Stars
- 51
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Unfortunately `html_linter` does not currently work with Python 3.5, returning the following error:
```
(mysite)Honorss-Air-2:templates Honors$ html_lint.py this_website.html
Traceback (most recent call last):
File "/Users/Honors/Desktop/mysite/bin/html_lint.py", line 119, in
sys.exit(main())
File "/Users/Honors/Desktop/mysite/bin/html_lint.py", line 109, in main
results = html_linter.lint(clean_html, exclude=exclude)
File "/Users/Honors/Desktop/mysite/lib/python3.5/site-packages/html_linter.py", line 1024, in lint
messages = [m.__unicode__() for m in HTML5Linter(html).messages
File "/Users/Honors/Desktop/mysite/lib/python3.5/site-packages/html_linter.py", line 529, in __init__
self.feed(html)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/html/parser.py", line 111, in feed
self.goahead(0)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/html/parser.py", line 163, in goahead
k = self.parse_starttag(i)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/html/parser.py", line 337, in parse_starttag
self.handle_starttag(tag, attrs)
File "/Users/Honors/Desktop/mysite/lib/python3.5/site-packages/html_linter.py", line 617, in handle_starttag
self._check_attributes_case_quotation_entities(tag, attrs)
File "/Users/Honors/Desktop/mysite/lib/python3.5/site-packages/html_linter.py", line 800, in _check_attributes_case_quotation_entities
for match in HTMLParser.attrfind.finditer(original_def, len(tag) + 1):
AttributeError: module 'html.parser' has no attribute 'attrfind'
```
A quick Google search for the nature of this problem brought up [this blog post](http://www.thefourtheye.in/2015/02/python-35-and-django-17s-htmlparseerror.html), which seems to point to `HTMLParseError` having been deprecated in Python 3.5.0.
[This commit](https://github.com/django/django/commit/b07aa52e8a8e4c7fdc7265f75ce2e7992e657ae9) was pushed to fix this issue for `Django`. My project uses `Flask`, though.
Hope to see this get fixed! In the meantime I am using online HTML validators and fixing post-facto, which is inelegant; for the meantime, does anyone know of a good workaround?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.