Base64 decoding in Python 3.2 type error

Psychic debugging: You probably passed a str object to the function, but base64.b64decode requires a bytes object. So, you’ll need to encode the string.

key = base64.b64decode(key.encode('ASCII'))

Note that Python 3.3 is more lenient and lets you pass either str or bytes.

Browse More Popular Posts

Leave a Comment