facing "azure.core.exceptions.ResourceModifiedError: The condition specified using HTTP conditional header(s) is not met" while trying to download azure blobs using python.

Muhsin Muhammed 0 Reputation points
2023-01-16T12:54:51.81+00:00

Hi,
I am trying to download blobs from my azure account using azure python SDK. I am using the chunks() method to download large sized blobs from containers. But I am facing the following error for large sized blobs.User's image

I have also tried several other methods of downloading a blob like readinto(), downloadtostream etc. but everything returns the same error. Any kind of help or suggestions are appreciated.

The code I wrote is this :-

with open(download_file_path, "wb") as file:
            data = blob_instance.download_blob()
            for stream in data.chunks():
                file.write(stream)
Azure Storage Explorer
Azure Storage Explorer
An Azure tool that is used to manage cloud storage resources on Windows, macOS, and Linux.
245 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,944 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,639 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jason Thorpe 5 Reputation points Microsoft Employee
    2023-02-09T15:31:33.3466667+00:00

    I suspect it is related to this SO post). I'm running into this issue when trying to download blob files that are constantly being updated by another service (Azure Synapse), though it works fine on blob files in another container that is not being updated in the same way. Specifically, I suspect that there is a race condition such that if the blob is updated between the call to blob_instance.download_blob() and data.chunks() then the ETAG (or some other header) becomes invalid between the two calls.

    1 person found this answer helpful.
    0 comments No comments