4 ms·
While it's been coming for a long time, it's still frustrating to see the cgi module go. It's going to create a load of busy work to rewrite some low-traffic sc
by imurray 4y ago
While it's been coming for a long time, it's still frustrating to see the cgi module go. It's going to create a load of busy work to rewrite some low-traffic scripts.
Modules being removed [edit: in 3.13]:
https://docs.python.org/dev/whatsnew/3.12.html#pending-removal-in-python-3-13 https://docs.python.org/dev/whatsnew/3.12.html#pending-remov...
Updating CGI scripts will be a bit fiddly: https://peps.python.org/pep-0594/#cgi https://peps.python.org/pep-0594/#cgi
- jwilk 4y agoYou linked to Python 3.13 removals. Python 3.12 removals are here: https://docs.python.org/dev/whatsnew/3.12.html#removed https://docs.python.org/dev/whatsnew/3.12.html#removed
- imurray 4y agoThanks. I did ctrl-f cgi as I knew its removal was coming and missed the heading. So one more point release of grace, but it's still coming soon.
- tyingq 4y agoThere is CGIHandler that ships with python. Not many examples that are simple, so... #!/usr/bin/env python from wsgiref.handlers import CGIHandler def app(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) return [ b"<html><head><title>foo</title></head><body>bar</body></html>" ] if __name__ == '__main__': CGIHandler().run(app)
- imurray 4y agoThank you!
- sigzero 4y agoJust copy out cgi.py and use it as a module. https://github.com/python/cpython/blob/3.11/Lib/cgi.py https://github.com/python/cpython/blob/3.11/Lib/cgi.py
- est 4y agoIt's even vendored!