title: Incorrect Padding error while decoding base64 encoding
body: <p>I have tried to decode a PDF I stored as BLOB and save it into a file with .pdf extension. results[0][1] has the BLOB data extracted from database query.</p>
  
  <pre><code>         blob_val=results[0][1]
           if len(blob_val) % 4 != 0:
              while len(blob_val) % 4 != 0:
                blob_val = blob_val + b"="
              decod_text = base64.b64decode(blob_val)
           else:
              decod_text = base64.b64decode(blob_val)
  </code></pre>
  
  <p>Eventhough i have added = at the end to correct padding errors, it is still showing incorrect padding error. why does it still shows this error even when we corrected it by "="?</p>