尝试检索 Blob 名称列表时出现“填充不正确”错误

问题描述 投票:0回答:1
  • azure-存储-blob
  • 版本12.19.1
  • Windows 10
  • Python 3.10.6
  • 超过 10k 个文件:

描述错误 尝试从 Azure Blob 存储容器检索 Blob 名称列表时,遇到“填充不正确”错误。即使 blob 上传和下载操作已成功,此问题似乎也会阻碍有效获取 blob 名称。

代码片段:

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)}")

错误消息:

Incorrect padding

其他成功操作:

  • Blob 上传
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)}")
  • 斑点下载
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)}")
python azure azure-blob-storage
1个回答
1
投票

请检查一下。我希望这个链接对您的项目配置设置有所帮助。

状态 403:此请求无权使用此权限执行此操作

© www.soinside.com 2019 - 2024. All rights reserved.