Now I am very desperate, because for almost 3 months no one can help me
to replace the discouraged function ‘cgi.FieldStorage’.
It’s a class, not a function.
The entire cgi module is deprecated and going away in Python 3.13. So
your desperation is somewhat warranted (though you’ve always got the
option of just sticking with it and a Python which provides it, which
will include 3.12).
The long term (or medium term, depending on your situation) solution is
to leave the Python stdlib cgi
module entirely. Have you read
PEP594? PEP 594 – Removing dead batteries from the standard library | peps.python.org
which admittedly does say “FieldStorage/MiniFieldStorage has no direct
replacement, but can typically be replaced by using multipart (for POST
and PUT requests) or urllib.parse.parse_qsl (for GET and HEAD
requests)”. The suggestions revolve around using the stuff in the
stdlib, which basicly means that you should roll your own or use a third
party library.
I want to read the requested arguments in the function
os.environ(‘REQUEST_MODE’) = ‘POST’, but I don’t know where to get them
from where to get them from.
You can’t just directly consult os.environ('REQUEST_MODE')
?
But this depends on the module you’re using to implement CGI.
Would like to have a clear example of this. And well without using interface programs like wsig, flags and django. I am using Windows 11, Apache from XAMPP (version 7.4.33) and Python 3.11.
So you’re wanting basic Python equivalent to FieldStorage
? I accept
that Django is a huge framework but is wsgi
?
What should I do now? Do you perhaps know a particular person who can
solve this important problem?
I’m not that person unfortunately.
I think my (naive) suggestion would be find an alternative CGI module.
Have you looked at: Search results · PyPI
for alternatives. I do not know enough to recommend (or reject) any of
them. Personally I would not waste my time on any which don’t have at
least a decent README on their PyPI page.
Maybe someone can point you at a forum or mailing list for Python CGI
users.
Good luck,
Cameron Simpson cs@cskk.id.au