![]() |
blockblobservice - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: blockblobservice (/thread-29900.html) |
blockblobservice - dakke - Sep-25-2020 Hi, The following import of BlockBlobService from azure.storage.blob import BlockBlobServiceyields the error message: ImportError: cannot import name 'BlockBlobService' from 'azure.storage.blob' The only working solution I found was to change to an older version of "azure-storage-blob" pip install azure-storage-blob==2.1.0 Anyway, my questions is: Is this error caused by a bug in latest version of "azure-storege-blob" or has 'BlockBlobService' been removed by intention? If 'BlockBlobService' has been removed by intention: Is there any replacement? There is multiple ways to do import, compared to above example importing BlockBlobService can be done by: import azure.storage.blob.blockblobserviceDoes it matter how BlockBlobService is imported (is both examples correct)? Thank you RE: blockblobservice - snippsat - Sep-25-2020 (Sep-25-2020, 09:03 AM)dakke Wrote: Is this error caused by a bug in latest version of "azure-storege-blob" or has 'BlockBlobService' been removed by intention?No the have just changed the packing structure,so now do you call it as shown in there documentation. Quick test. >>> from azure.storage.blob import BlobServiceClient >>> BlobServiceClient.api_version <property object at 0x077960F0> >>> help(BlobServiceClient.api_version) Help on property: The version of the Storage API used for requests. :type: str >>> import azure.storage.blob.blockblobservice Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'azure.storage.blob.blockblobservice'There is still a way to do the older call but the have put _ which mean that should not mess with it.>>> import azure.storage.blob._blob_service_client # Do this trix >>> blob = azure.storage.blob._blob_service_client.BlobServiceClient >>> blob.api_version <property object at 0x0916D420> >>> help(blob.api_version) Help on property: The version of the Storage API used for requests. :type: strBut come to same place,so now use first one as they updated in package and documentation. |