Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drop-in replacement for the cgi module

Tags:

python

cgi

Python 3.13 removed the cgi module.

While there are many ways described how to workaround that issue, e.g. via using urllib and the email package, for one project I actually need a drop-in replacement, that is a package which also offers a FieldStorage class which I can use instead of the removed one.

I have read about such a project a few weeks ago, but unfortunately did not bookmark it.

tl/dr

  • I look for a package which offers a FieldStorage class as a replacement for the removed cgi.FieldStorage in Python 3.13.
  • I am not interested in ways to rewrite the code via urllib and the email package
  • Werkzeug is not a drop-in replacement

Thank you!

like image 767
Jürgen Gmach Avatar asked May 06 '26 22:05

Jürgen Gmach


1 Answers

It seems other people had the same need.

The Python CGI package is a drop-in replacement for the cgi package, which was removed from Python 3.13 onwards.

https://github.com/jackrosenthal/python-cgi

In order to use it, you only have to

pip install legacy-cgi

There are no code changes required.

like image 99
Jürgen Gmach Avatar answered May 09 '26 10:05

Jürgen Gmach



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!