incremental-reading icon indicating copy to clipboard operation
incremental-reading copied to clipboard

Python 3.9 compatibilty issue : AttributeError: module 'base64' has no attribute 'decodestring'

Open sosie-js opened this issue 4 years ago • 0 comments

Describe the bug On launch I got the error

addons21/935264945/lib/feedparser.py", line 93, in <module>
    _base64decode = getattr(base64, 'decodebytes', base64.decodestring)
AttributeError: module 'base64' has no attribute 'decodestring'

How To Solve Edit feedparser.py and complete the script from

try:
    import base64, binascii
except ImportError:
    base64 = binascii = None
else:
    # Python 3.1 deprecates decodestring in favor of decodebytes
    _base64decode = getattr(base64, 'decodebytes', base64.decodestring)

to

try:
    import base64, binascii
except ImportError:
    base64 = binascii = None
else:
    import sys
    if not sys.version_info.major == 3 and sys.version_info.minor >= 9:
        # Python 3.1 deprecates decodestring in favor of decodebytes
        _base64decode = getattr(base64, 'decodebytes', base64.decodestring)
    else:
        _base64decode = getattr(base64, 'decodebytes', base64.decodebytes)

have a nice week..

sosie-js avatar Sep 12 '21 17:09 sosie-js