I am trying to read file from Google cloud storage bucket with blob.open but it is giving error that blob does not have open attribute! How to resolve this ? Thank you in advance!
# Instantiates a client
#storage_client = storage.Client()
storage_client = storage.Client.from_service_account_json('service-account-file.json')
# The name of bucket
bucket_name = "bucket"
file_name = "sample.txt"
bucket = storage_client.bucket(bucket_name)
blob = bucket.blob(file_name)
blob = bucket.blob(file_name)
with blob.open("rt") as f:
print(f.read())```
Traceback (most recent call last):File "test/read-test-3.py", line 15, in <module> with blobs.open("rt") as f: AttributeError: 'Blob' object has no attribute 'open'