html.escape not found in python2
See original GitHub issueError message:
Traceback (most recent call last):
File "linkfinder.py", line 375, in <module>
url = html.escape(endpoint["link"])
AttributeError: 'module' object has no attribute 'escape'
Last time I fixed this issue, it turns out that LinkFinder worked on my machine because I silently have “future” package installed. Any machine running python2 without that package will fail.
Thank you Vishal for reporting this to me.
Here is the point of this issue. Should I still fix it as python2 support ? Fixing it will take just few minutes but it will make the code bit messier and python2 will be deprecated in 4 months anyway.
@EdOverflow What is your opinion ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
What's the easiest way to escape HTML in Python?
html. escape is the correct answer now, it used to be cgi. escape in python before 3.2. It escapes:
Read more >What is html.escape() in Python? - Educative.io
When storing raw HTML in databases or variables, we need to escape special characters that are not markup text but might be confused...
Read more >Escaping HTML - Python Wiki
Escaping HTML · The cgi module that comes with Python has an escape() function: · However, it doesn't escape characters beyond &, <,...
Read more >html.escape() in Python - GeeksforGeeks
With the help of html.escape() method, we can convert the html script into a string by replacing special characters with the string with...
Read more >cgi.escape is deprecated since python 3.2 and not ... - GitLab
html.escape should be used instead Links: https://docs.python.org/3.7/library/cgi.html#cgi.escape https://docs.python.org/3.8/library/cgi.html#functions.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Updated accordingly. Let me know if that works for you, @Bankde.
Yes we should. Could you please update few lines ? In readme.txt
LinkFinder supports Python 2 & 3.
In linkfinder.py
Line 2: # Python 2.7.x - 3.6.x
So I don’t have to create PR.I have noticed some messes that (possibly!?) come from supporting python2 such in Line 16-26. This might take some time to figure out what happens there so I will create PR later.
Thank you.