ZeroNet
ZeroNet copied to clipboard
AttributeError: module 'cgi' has no attribute 'parse_qsl' in UiServer.py line 41 > pywsgi.py line 945 > UiServer.py line 98
Step 1: Please describe your environment
FreeBSD 13 with python-38
Step 2: Describe the problem:
Errors:
[22:32:31] - UiWSGIHandler error: AttributeError: module 'cgi' has no attribute 'parse_qsl' in UiServer.py line 41 > pywsgi.py line 945 > UiServer.py line 98
[22:32:31] - UiWSGIHandler error: AttributeError: module 'cgi' has no attribute 'parse_qsl' in UiServer.py line 41 > pywsgi.py line 945 > UiServer.py line 98
cgi.parse_qsl is deprecated and removed.
Here is the patch:
--- src/Ui/UiServer.py.orig 2019-09-04 18:16:57 UTC
+++ src/Ui/UiServer.py
@@ -4,6 +4,7 @@ import cgi
import socket
import sys
import gevent
+import urllib
from gevent.pywsgi import WSGIServer
from gevent.pywsgi import WSGIHandler
@@ -95,7 +96,7 @@ class UiServer:
def handleRequest(self, env, start_response):
path = bytes(env["PATH_INFO"], "raw-unicode-escape").decode("utf8")
if env.get("QUERY_STRING"):
- get = dict(cgi.parse_qsl(env['QUERY_STRING']))
+ get = dict(urllib.parse.parse_qsl(env['QUERY_STRING']))
else:
get = {}
ui_request = UiRequest(self, get, env, start_response)
Experieced this too on Manjaro with python3 == 3.9.
For reference:
@Tio cgi.parse_qsl has been deprecated since Python 3.2 and been removed in Python 3.8 This problem has been fixed in the latest commit of upstream but not yet released. https://docs.python.org/3.8/whatsnew/3.8.html#api-and-feature-removals -- TJM @ AUR https://aur.archlinux.org/packages/zeronet/#comment-766256