Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Looks like CGI was recently removed from python 3. https://docs.python.org/3/library/cgi.html

What is a modern python-friendly alternative?






Python has a policy against maintaining compatibility with boring technology. We discussed this at some length in this thread the other day at https://news.ycombinator.com/item?id=44477966; many people voiced their opposition to the policy. The alternatives suggested for the specific case of the cgi module were:

- wsgiref.handlers.CGIHandler, which is not deprecated yet. gvalkov provided example code for Flask at https://news.ycombinator.com/item?id=44479388

- use a language that isn't Python so you don't have to debug your code every year to make it work again when the language maintainers intentionally break it

- install the old cgi module for new Python from https://github.com/jackrosenthal/legacy-cgi

- continue using Python 3.12, where the module is still in the standard library, until mid-02028




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: