Categories
Python Answers

How to ignore ‘Incorrect padding’ error when base64 decoding with Python?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *