• Register
0 votes
739 views

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

Please log in or register to answer this question.

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 52 views
0 votes
1 answer 161 views
161 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, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 3.3K views
3.3K 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 1.5K views
1.5K views
Problem : I am currently working on a django and I have gotten the below error: “Type object 'datetime.datetime' has no attribute 'datetime'” On a below line: date = datetime.datetime(int(year), int(month), 1) Does someone know any reason for above error?
asked Jan 28, 2020 jwilliam 3.9k points
0 votes
1 answer 48 views
48 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, 2020 psandprop 2.4k points
0 votes
1 answer 160 views
160 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, 2020 psandprop 2.4k points
0 votes
1 answer 21 views
21 views
Problem: I want to count the number of times a word is being repeated in the review string I am reading the csv file and storing it in a python dataframe using the below line reviews = pd.read_csv("amazon_baby.csv") The code in the below lines work when I apply it to a single review. print reviews["review"][1] a = reviews["review"][1].split("disappointed") print a b = len(a) print b
asked 5 days ago Mashhoodch 9.3k points
0 votes
1 answer 16 views
16 views
Problem: attributeerror: 'series' object has no attribute 'reshape'
asked Feb 18 charles mathews 3.8k points
0 votes
1 answer 455 views
455 views
When trying to find the index of v but it gave me: 'numpy.ndarray' object has no attribute 'index' none of them have answered my question v = np.random.randn(10) print(v) maximum = np.max(v) minimum = np.min(v) print(maximum, minimum) v.index(maximum, minimum)
asked Oct 30, 2020 psandprop 2.4k points
0 votes
1 answer 314 views
314 views
Python 3.3.2 import json & urllib.request Json [{"link":"","orderid":"100000222"}, {"link":"","orderid":"100000222"}, {"link":"","orderid":"100000222"}] print(response.info()) Date: Sun, 20 Oct 2013 07:06:51 GMT Server: Apache X-Powered-By: PHP/5.4.12 Content ... line 271, in load return loads(fp.read(), AttributeError: 'str' object has no attribute 'read' >>> . Any idea how i can fix this issue?
asked Oct 25, 2020 psandprop 2.4k points