CGI module deprecated Python 3.13
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?
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?
Re: CGI module deprecated Python 3.13
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.
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.
Re: CGI module deprecated Python 3.13
Thanks for that info. I shall look up and learn.
Re: CGI module deprecated Python 3.13
If you don't want to change the code, then use this maybe: https://github.com/jackrosenthal/legacy-cgi
Re: CGI module deprecated Python 3.13
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?
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?
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion