Search code examples
pythonparsingvisual-studio-codeazure-blob-storageshared-access-signatures

How to work with the blob error in VsCode


enter image description hereThe Error is as shown in the image

enter image description here


Solution

  • 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