Roundup Tracker - Issues

Issue 2551110

classification
AttributeError: module 'base64' has no attribute 'decodestring'
Type: crash Severity: critical
Components: Web interface Versions: 2.0.0
process
Status: closed fixed
:
: : ngaba, rouilj
Priority: high :

Created on 2021-01-14 09:42 by ngaba, last changed 2021-02-06 23:58 by ngaba.

Messages
msg7052 Author: [hidden] (ngaba) Date: 2021-01-14 09:42
After upgrading to Python 3.9, I get this error message when running demo.py:

Traceback (most recent call last):
  File "/home/ngaba/roundup-2.0.0/./demo.py", line 5, in <module>
    from roundup.demo import main
  File "/home/ngaba/roundup-2.0.0/roundup/demo.py", line 20, in <module>
    from roundup.scripts import roundup_server
  File "/home/ngaba/roundup-2.0.0/roundup/scripts/roundup_server.py", line 77, in <module>
    favico = zlib.decompress(base64.decodestring(b'''
AttributeError: module 'base64' has no attribute 'decodestring'


This seems to be a known issue in Python 3.9. (Changing decodestring to decodebytes seems to work, but then Python2 gives an error...)

What is the intended fix here? I am new to Python.
msg7053 Author: [hidden] (rouilj) Date: 2021-01-14 19:39
This was fixed in December in the current tip: rev 6295:bc2b00afa980
and will be in the next release of roundup.

You can edit roundup-server and replace base64.decodestring with 
base64.b64decode which works on both 2.7 and 3.x.

Diff of the commit:

diff -r 48a0f724ffbc -r bc2b00afa980 roundup/scripts/roundup_server.py
--- a/roundup/scripts/roundup_server.py Sun Nov 29 16:11:22 2020 -0500
+++ b/roundup/scripts/roundup_server.py Mon Dec 14 09:52:58 2020 -0500
@@ -74,7 +74,7 @@
 # "default" favicon.ico
 # generate by using "icotool" and tools/base64
 import zlib, base64
-favico = zlib.decompress(base64.decodestring(b'''
+favico = zlib.decompress(base64.b64decode(b'''
 
eJztjr1PmlEUh59XgVoshdYPWorFIhaRFq0t9pNq37b60lYSTRzcTFw6GAfj5gDYaF0dTB0M
xMSE
 
gQQd3FzKJiEC0UCIUUN1M41pV2JCXySg/0ITn5tfzvmdc+85FwT56HSc81UJjXJsk1UsNcsS
qCk1
 
BS64lK+vr7OyssLJyQl2ux2j0cjU1BQajYZIJEIwGMRms+H3+zEYDExOTjI2Nsbm5iZWqxWv
18vW
diff -r 48a0f724ffbc -r bc2b00afa980 
roundup/scripts/roundup_xmlrpc_server.py
--- a/roundup/scripts/roundup_xmlrpc_server.py  Sun Nov 29 16:11:22 2020 
-0500
+++ b/roundup/scripts/roundup_xmlrpc_server.py  Mon Dec 14 09:52:58 2020 
-0500
@@ -64,7 +64,7 @@
         scheme, challenge = authorization.split(' ', 1)

         if scheme.lower() == 'basic':
-            decoded = base64.decodestring(challenge)
+            decoded = base64.b64decode(challenge)
             if ':' in decoded:
                 username, password = decoded.split(':')
             else:

Have a great week.

-- rouilj
msg7069 Author: [hidden] (ngaba) Date: 2021-02-06 23:58
Dear John,

Thank you very much. (I am sorry for the late response.)

Have a greet week.
History
Date User Action Args
2021-02-06 23:58:18ngabasetmessages: + msg7069
2021-01-14 19:39:32rouiljsetstatus: new -> closed
nosy: + rouilj
messages: + msg7053
priority: high
components: + Web interface, - API
resolution: fixed
2021-01-14 09:42:08ngabacreate