question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

html.escape not found in python2

See original GitHub issue

Error 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:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
EdOverflowcommented, Aug 8, 2019

Updated accordingly. Let me know if that works for you, @Bankde.

1reaction
Bankdecommented, Aug 8, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found