Sometimes, we want to ignore ‘Incorrect padding’ error when base64 decoding with Python.
In this article, we’ll look at how to ignore ‘Incorrect padding’ error when base64 decoding with Python.
How to ignore ‘Incorrect padding’ error when base64 decoding with Python?
To ignore ‘Incorrect padding’ error when base64 decoding with Python, we add the padding to the base64 string.
For instance, we write
base64.b64decode(s + b'==')
to call b64decode
with the base64 string s
concatenated with the padding string to decode the string without errors.
Conclusion
To ignore ‘Incorrect padding’ error when base64 decoding with Python, we add the padding to the base64 string.