AttributeError: module html.parser has no attribute HTMLParseError

2024/11/19 17:36:06
  1. This is the hints,how can I resolve it?
  2. I use Python 3.5.1 created a virtual envirement by virtualenv
  3. The source code works well on my friend's computer machine

Error:

Traceback (most recent call last):File "manage.py", line 10, in <module>execute_from_command_line(sys.argv)File "A:\Python3.5\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_lineutility.execute()File "A:\Python3.5\lib\site-packages\django\core\management\__init__.py", line 354, in executedjango.setup()File "A:\Python3.5\lib\site-packages\django\__init__.py", line 18, in setupfrom django.utils.log import configure_loggingFile "A:\Python3.5\lib\site-packages\django\utils\log.py", line 13, in <module>from django.views.debug import ExceptionReporter, get_exception_reporter_filterFile "A:\Python3.5\lib\site-packages\django\views\debug.py", line 10, in <module>from django.http import (HttpResponse, HttpResponseServerError,File "A:\Python3.5\lib\site-packages\django\http\__init__.py", line 4, in <module>from django.http.response import (File "A:\Python3.5\lib\site-packages\django\http\response.py", line 13, in <module>from django.core.serializers.json import DjangoJSONEncoderFile "A:\Python3.5\lib\site-packages\django\core\serializers\__init__.py", line 23, in <module>from django.core.serializers.base import SerializerDoesNotExistFile "A:\Python3.5\lib\site-packages\django\core\serializers\base.py", line 6, in <module>from django.db import modelsFile "A:\Python3.5\lib\site-packages\django\db\models\__init__.py", line 6, in <module>from django.db.models.query import Q, QuerySet, Prefetch  # NOQAFile "A:\Python3.5\lib\site-packages\django\db\models\query.py", line 13, in <module>from django.db.models.fields import AutoField, EmptyFile "A:\Python3.5\lib\site-packages\django\db\models\fields\__init__.py", line 18, in <module>from django import formsFile "A:\Python3.5\lib\site-packages\django\forms\__init__.py", line 6, in <module>from django.forms.fields import *  # NOQAFile "A:\Python3.5\lib\site-packages\django\forms\fields.py", line 18, in <module>from django.forms.utils import from_current_timezone, to_current_timezoneFile "A:\Python3.5\lib\site-packages\django\forms\utils.py", line 15, in <module>from django.utils.html import format_html, format_html_join, escapeFile "A:\Python3.5\lib\site-packages\django\utils\html.py", line 16, in <module>from .html_parser import HTMLParser, HTMLParseErrorFile "A:\Python3.5\lib\site-packages\django\utils\html_parser.py", line 12, in <module>HTMLParseError = _html_parser.HTMLParseError
AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
Answer

As you can read here this error is raised...

because HTMLParseError is deprecated from Python 3.3 onwards and removed in Python 3.5.

What you can do is downgrade your Python version or upgrade your Django version.

https://en.xdnf.cn/q/26413.html

Related Q&A

Error message python-pylint C0103:Invalid constant name

Im confused about the error(s) in this photo:I dont know how to fix them. My program is a Python-Flask web frame. When I use Visual Studio Code to debug my program, Pylint shows these errors. I know th…

How to use virtualenv with python3.6 on ubuntu 16.04?

Im using Ubuntu 16.04, which comes with Python 2.7 and Python 3.5. Ive installed Python 3.6 on it and symlink python3 to python3.6 through alias python3=python3.6.Then, Ive installed virtualenv using s…

Is a day always 86,400 epoch seconds long?

While reviewing my past answers, I noticed Id proposed code such as this:import timedef dates_between(start, end):# muck around between the 9k+ time representation systems in Python# now start and end …

Find the first instance of a nonzero number in a list in Python [duplicate]

This question already has answers here:Return the index of the first element of a list which makes a passed function true(7 answers)Closed last year.I have a list like this: myList = [0.0, 0.0, 0.0, 2.…

How to debug a Python module in Visual Studio Codes launch.json

My question may seem simple but, I have a module that I launch in a terminal like this: python -m my_module.my_fileHow do I debug this in Visual Studio Code? I have this in my launch.json (documentati…

Cleanest Fastest server setup for Django [closed]

Closed. This question is opinion-based. It is not currently accepting answers.Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.Clo…

Quicker to os.walk or glob?

Im messing around with file lookups in python on a large hard disk. Ive been looking at os.walk and glob. I usually use os.walk as I find it much neater and seems to be quicker (for usual size direct…

Getting PyCharm to recognize python on the windows linux subsystem (bash on windows)

While running Linux versions of python, pip etc. "natively" on windows is amazing, Id like to do so using a proper IDE. Since SSHD compatibility has not been implemented yet, Im trying get Py…

Whats the difference between nan, NaN and NAN

In numpy there are nan, NaN and NAN. Whats the sense of having all three, do they differ or any of these can be used interchangeably?

Python requests: URL base in Session

When using a Session, it seems you need to provide the full URL each time, e.g.session = requests.Session() session.get(http://myserver/getstuff) session.get(http://myserver/getstuff2)This gets a littl…