skip to Main Content

enter image description hereThe Error is as shown in the image

enter image description here

2

Answers


  1. The package you imported is incorrect.

    The method from_blob_url belong to package BlobClient instead of BlobServiceClient.

    enter image description here

    from azure.storage.blob import BlobClient
    BlobClient.from_blob_url
    
    Login or Signup to reply.
  2. I followed the below Steps to download the file from the
    blob storage to local path

    • I tried your code and got the same as yours

    enter image description here

    • Adding input to @MingJie-MSFT

    • Create an Azure Storage account, Container and Upload the file

    enter image description here

    • In visual studio code enter the below code, give your bloburl and file name.

    enter image description here

    
    from fileinput import filename
    from azure.storage.blob import BlobServiceClient
    from azure.storage.blob import BlobClient
    
    
    blob_url = "your blob url"
    file_name = "hello2.log"
    
    blob_client= BlobClient.from_blob_url(blob_url)
    with open(file_name, "wb") as my_blob:
        download_stream= blob_client.download_blob()   
        my_blob.write(download_stream.readall())
    
    
    
    • Run the code

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search