cgi.escape was removed in Python 3.8
See original GitHub issueI just stumbled across this grepping for cgi.escape
. I am not sure Tempita is public and documented for usage but found a usage causing AttributeError
. cgi.escape
was removed in Python 3.8 with https://github.com/python/cpython/pull/7662 . Usage of html.escape
is recommended.
Python 3.8.0 (default, Nov 6 2019, 21:49:08)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Cython.Tempita
>>> Cython.Tempita.HTMLTemplate("a")._repr(1, 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Cython/Tempita/_tempita.py", line 489, in Cython.Tempita._tempita.HTMLTemplate._repr
File "Cython/Tempita/_tempita.py", line 446, in Cython.Tempita._tempita.html_quote
AttributeError: module 'cgi' has no attribute 'escape'
Thanks for Cython!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
cgi.escape is deprecated since python 3.2 and not ... - GitLab
escape is deprecated since python 3.2 and not available on python 3.8. All threads resolved!
Read more >salt: cgi.escape() has been removed in python 3.8
escape has been deprecated since python 3.2 and removed in 3.8. + +Index: salt/returners/highstate_return.py +--- salt/returners/ ...
Read more >ImportError: cannot import name 'escape' from 'cgi'
cgi.escape() has been removed in python 3.8. Quoting from here,. parse_qs, parse_qsl, and escape are removed from the cgi module.
Read more >1827745 – Python 3.8: module 'cgi' has no attribute 'escape'
Description of problem: urlwatch uses cgi.escape which was deprecated in Python 3.7 and removed in 3.8. A possible alternative is html.escape.
Read more >AttributeError: module 'cgi' has no attribute 'escape' in Python ...
The problem is the function cgi.escape in https://gitlab.com/inorton/junit2html/-/blob/master/junit2htmlreport/tag.py#L17 which is removed in ...
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 FreeTop Related Reddit Thread
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
Top GitHub Comments
+1 for removing the obviously broken HTML parts. If users employ Tempita on their side, it’s for source code generation, not HTML. There are much better tools for the latter.
The background is that Tempita was originally a generic templating tool. It was incorporated into Cython to use for templating Cython’s utility code, but obviously contains quote a bit of stale code from its original general use.
My view would be to just remove
html_quote
and the stuff that depends on it. We’ll quite rapidly find out if it breaks any of Cython’s utility code generation (its primary use) since that is covered by the the test-suite.A few projects (Pandas, Scipy) do use Tempita from Cython to do some code-generation of Cython code. This is also a use-case that we’re keen to support better, so possibly we possibly shouldn’t be too brutal removing everything that’s unused. I still think it’s reasonable to remove these html bits that have been broken for years.
With that said, I’m happy to do the removal myself if you’d rather someone else gets the blame for it!