Getting "Incorrect padding" error when trying to retrieve the list of blob names

55 Views Asked by At
  • azure-storage-blob:
  • Version 12.19.1:
  • Windows 10:
  • Python 3.10.6:
  • Over 10k files:

Describe the bug When attempting to retrieve the list of blob names from the Azure Blob Storage container, an "Incorrect padding" error is encountered. This issue seems to be causing a hindrance in fetching the blob names effectively, even though the blob upload and download operations have been successful.

Code Snippet:

try:
    # Get the list of blobs in the container
    blob_list = self.container_client.list_blobs()

    print("List of blobs:")
    for blob in blob_list:
        print(blob.name)
except Exception as e:
    print(f"An error occurred while retrieving the list of blobs: {str(e)}")

Error Message: Incorrect padding

Additional Successful Operations:

  • Blob Upload
def upload(self, blob_data, blob_name):
        try:
            # Upload a blob to the container
            self.container_client.upload_blob(name=blob_name, data=blob_data)
            print(f"Blob '{blob_name}' uploaded successfully.")
        except Exception as e:
            print(f"An error occurred while uploading blob '{blob_name}': {str(e)}")
  • Blob Download
def download(self, blob_name):
        try:
            # Get the BlobClient for the blob
            blob_client = self.container_client.get_blob_client(blob_name)

            # Download the blob to a local file
            with open(blob_name, "wb") as blob:
                download_stream = blob_client.download_blob()
                blob.write(download_stream.readall())
            print(f"Blob '{blob_name}' downloaded successfully.")
        except Exception as e:
            print(f"An error occurred while downloading blob '{blob_name}': {str(e)}")
1

There are 1 best solutions below

2
Ted Saldivar On BEST ANSWER

Please check this. I hope this link will be helpful to your project config setting.

Status 403: This request is not authorized to perform this operation using this permission