We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

5 posts • Page 1 of 1
Duggieb
Posts: 31
Joined: Wed May 26, 2021 8:39 pm

CGI module deprecated Python 3.13

Fri Oct 10, 2025 12:01 pm

I have a personal website http://robinboardman.me.uk, which I host on a Raspberry Pi 5 at home (uses apache). When I first wrote the site using PHP, I set up a guestbook which I have recently re-written in Python. This worked fine until I carried out a recent upgrade to Trixie which upgraded Python to version 3.13.
To handle the HTML form and the data via which visitors posted messages, I used the cgi module in Python and the FieldStorage method to extract and process the input data. However, the cgi module has been deprecated in Python 3.13 and hence my guestbook no longer works. I cannot find an obvious alternative in Python for the cgi.FieldStorage() method (cgi-legacy is mentioned but this seems a backward step). Does anyone have nay suggestions please?

DeaD_EyE
Posts: 247
Joined: Sat May 17, 2014 9:49 pm

Re: CGI module deprecated Python 3.13

Fri Oct 10, 2025 12:31 pm

https://docs.python.org/3.13/whatsnew/3 ... s-and-apis

cgi.FieldStorage can typically be replaced with urllib.parse.parse_qsl() for GET and HEAD requests, and the email.message module or the multipart library for POST and PUT requests.

Duggieb
Posts: 31
Joined: Wed May 26, 2021 8:39 pm

Re: CGI module deprecated Python 3.13

Fri Oct 10, 2025 7:56 pm

Thanks for that info. I shall look up and learn.

DeaD_EyE
Posts: 247
Joined: Sat May 17, 2014 9:49 pm

Duggieb
Posts: 31
Joined: Wed May 26, 2021 8:39 pm

Re: CGI module deprecated Python 3.13

Mon Oct 13, 2025 1:53 pm

Thanks for the reply but I am trying to just use Python 3.13 rather than legacy code.
I have decided to change the form method to GET and use os.environ.get('QUERY_STRING')

It will be obvious that I am a novice in Python. To further expand my Python abilities, I have followed example code to build a "bubble game" which I can run via Thonny and am using Python to run the Guestbook on my website. However, I feel progress is slow. Does anyone have any suggestions as to what path to follow to become more proficient in Python eg web courses, books to buy?

5 posts • Page 1 of 1

Return to "Python"

AltStyle によって変換されたページ (->オリジナル) /