Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'HTMLParser' object has no attribute 'unescape' #831

Open
muntasirjoarder opened this issue Aug 3, 2022 · 6 comments
Open

Comments

@muntasirjoarder
Copy link

馃毃Please review the Troubleshooting section
before reporting any issue. Don't forget to check also the current issues to
avoid duplicates.

Subject of the issue

It was just working fine yesterday. But today it is producing the error.

Your environment

  • Operating System (name/version): Windows 10 Pro
  • Python version: 3.9.4
  • coursera-dl version: coursera_dl version 0.11.5

Steps to reproduce

I configured the coursera-dl.conf file.
And the following command to download the course:

coursera-dl

Expected behaviour

Should download in folders

Actual behaviour

Following was the output:

D:\Muntasir\Course\Coursera>coursera-dl microsoft-azure-dp-203-data-engineering
coursera_dl version 0.11.5
Downloading class: microsoft-azure-dp-203-data-engineering (1 / 1)
Parsing syllabus of on-demand course (id=V0KQ6Km_EeuLCQ6P36XDuw). This may take some time, please be patient ...
Processing module the-evolving-world-of-data-and-the-data-engineer
Processing section welcome-to-the-course
Processing lecture introduction-to-the-program (lecture)
Processing lecture introduction-to-the-course (lecture)
Processing lecture dp-900-microsoft-azure-ai-fundamentals-certification (lecture)
Processing lecture course-syllabus (supplement)
Processing lecture exam-dp-203-skills-measured (supplement)
Processing lecture how-to-be-successful-in-this-course (supplement)
Processing lecture meet-and-greet (discussionPrompt)
Unsupported typename "discussionPrompt" in lecture "meet-and-greet" (lecture id "2VF4d")
Processing section the-evolving-world-of-data
Processing lecture lesson-introduction (lecture)
Processing lecture data-abundance (lecture)
Processing lecture the-difference-between-on-premises-and-cloud-based-servers (lecture)
Processing lecture understand-job-responsibilities (lecture)
Processing lecture use-cases-for-the-cloud (lecture)
Processing lecture knowledge-check (quiz)
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Python39\Scripts\coursera-dl.exe_main
.py", line 7, in
File "c:\python39\lib\site-packages\coursera\coursera_dl.py", line 247, in main
error_occurred, completed = download_class(
File "c:\python39\lib\site-packages\coursera\coursera_dl.py", line 214, in download_class
return download_on_demand_class(session, args, class_name)
File "c:\python39\lib\site-packages\coursera\coursera_dl.py", line 134, in download_on_demand_class
error_occurred, modules = extractor.get_modules(
File "c:\python39\lib\site-packages\coursera\extractors.py", line 53, in get_modules
error_occurred, modules = self._parse_on_demand_syllabus(
File "c:\python39\lib\site-packages\coursera\extractors.py", line 174, in _parse_on_demand_syllabus
links = course.extract_links_from_quiz(
File "c:\python39\lib\site-packages\coursera\api.py", line 783, in extract_links_from_quiz
return self._convert_quiz_json_to_links(quiz_json, 'quiz')
File "c:\python39\lib\site-packages\coursera\api.py", line 792, in _convert_quiz_json_to_links
markup = self._quiz_to_markup(quiz_json)
File "c:\python39\lib\site-packages\coursera\api.py", line 107, in call
question_text = unescape_html(prompt['definition']['value'])
File "c:\python39\lib\site-packages\coursera\utils.py", line 102, in unescape_html
s = h.unescape(s)
AttributeError: 'HTMLParser' object has no attribute 'unescape'

@crissy99
Copy link

Have the same issue here

@cvyh
Copy link

cvyh commented Aug 15, 2022

The unescape() method in the HTMLParser class has been removed in 3.9, you need 3.8.

@crissy99
Copy link

The unescape() method in the HTMLParser class has been removed in 3.9, you need 3.8.

but in the documentation it says that it needs 3.9 or later , ill try anyway thanks

@crissy99
Copy link

3.9, you need 3.8.

You are a wizard harry , It worked thanks a bunch

@soumitrapy
Copy link

I am using python 3.10 and I have the same problem. Is there any solution without changing the version of python?

@raffaem
Copy link

raffaem commented Nov 6, 2022

The unescape() method in the HTMLParser class has been removed in 3.9, you need 3.8.

Or use html.unescape in its place, as the changelog for Python 3.9 says:

The unescape() method in the html.parser.HTMLParser class has been removed (it was deprecated since Python 3.4). html.unescape() should be used for converting character references to the corresponding unicode characters.

I am using python 3.10 and I have the same problem. Is there any solution without changing the version of python?

You can refer to my fork 馃槂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants