You have a file html.py
(or html.pyc
) somewhere in your Python path:
$ touch html.py
$ python3 -c 'import html.parser'
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'html.parser'; 'html' is not a package
Simply rename the file (to myhtml.py
). If you are unsure where it is, you can print its location with
# Insert temporarily before the problematic line
import html
print(html.__file__)