• Register
0 votes

Problem :

I am new to HTMLParser my terminal showing me below error :-

from django.utils.html import format_html, format_html_join, escape
File "/usr/local/lib/python3.5/dist-packages/django/utils/html.py", line 16, in
from .html_parser import HTMLParser, HTMLParseError
File "/usr/local/lib/python3.5/dist-packages/django/utils/html_parser.py", line 12, in
HTMLParseError = _html_parser.HTMLParseError
AttributeError: module 'html.parser' has no attribute 'HTMLParseError'

My Configuration is Python 3.5, Django 1.7.7 also using pip3

I have researched on it  some experts are saying HTML parser is removed on a Python 3.5 version.

So how can I fix this?

Should I replace the HTMLParser with some other similar?

Or should I try to downgrade the python ?

Can someone help on this issue?

8 4 2
2,300 points

1 Answer

0 votes

Solution :

I have gone through your question. Please go through my solution on your issue.

You should go with python 3.4.

If you are currently using the Ubuntu then you can install python 3.4 very easily with the help of below instruction.

If you prefer to install your packages using a APT package manager then my suggestion to you is installing it from the well-known PPA that should provide you a long list of versions of Python for long list of Ubuntu versions.

You can add a deadsnakes PPA if you want then you can read more about it at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:

sudo add-apt-repository ppa:deadsnakes/ppa

Now you can install the python3.4 with help of below commands:

sudo apt-get update

sudo apt-get install python3.4

After installing it now you can create the virtualenv with python 3.4 as below

$ virtualenv .env -p /usr/bin/python3.4

$ source .env/bin/activate

5 2 1
4,980 points

Related questions

0 votes
1 answer 59 views
Problem: I am facing this error in my logs with the django app. Initially I thought such errors tend to occur if using Python 2.x but in my virtual environment you can see Python - 3.6.5. Django - 2.0.7. VESTA Control Panel with the wsgi. My Error ... '] = 'main.settings' -import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() I will be very happy for any help.
asked Aug 24 Raphael Pacheco 4.9k points
1 vote
1 answer 2.6K views
Problem : I have installed the pip for python 3.6 on my Ubuntu 14. By using below command : sudo apt-get install python3-pip Now to install pip3, it works very well. But after doing the installation, when I want to run it by using below command : pip3 ... has no attribute "SourceFileLoader" It appears that I did nothing wrong but I am really unable to figure out the reason behind the above error.
asked Dec 23, 2019 alecxe 7.5k points
0 votes
1 answer 6 views
I have tried to follow the documentation but was not able to use urlparse.parse.quote_plus() in Python 3: from urllib.parse import urlparse params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'}) I get AttributeError: 'function' object has no attribute 'parse'
asked Oct 25 psandprop 2.4k points
0 votes
1 answer 12 views
This line: sift = cv2.xfeatures2d.SIFT_create() return error: Traceback (most recent call last): File "C:/Python27/openCVskrypty/GUI/SOLUTION2.py", line 11, in <module> sift = cv2.xfeatures2d.SIFT_create() AttributeError: 'module' object has no attribute 'xfeatures2d' I ... ) and I haven't got xfeatures2d module. Does anyone know why? Can I download it separately? Thanks for help how fix this.
asked Oct 24 psandprop 2.4k points