Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
blockblobservice
#1
Hi,

The following import of BlockBlobService
from azure.storage.blob import BlockBlobService
yields 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.blockblobservice
Does it matter how BlockBlobService is imported (is both examples correct)?

Thank you
Reply
#2
(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: str
But come to same place,so now use first one as they updated in package and documentation.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020