Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

blob.download_as_bytes fails when called with client.batch() #948

Description

@jignesh-crest

Environment details

  • OS type and version: Ubuntu
  • Python version: 3.10
  • pip version: 21.2.4
  • google-cloud-storage version: 2.7.0

Code example

blob_list=storage_client.list_blobs(bucket_or_name="bucket-name")
data_dict= {}
withstorage_client.batch():
forblobinblob_list:
data_dict[blob.name] =blob.download_as_bytes()
print(data_dict)

Stack trace

Traceback (most recent call last):
File "/root/connectorDevelopment/GCP/batch/manual-get-blob.py", line 45, in <module>
print_blob_acl(
File "/root/connectorDevelopment/GCP/batch/manual-get-blob.py", line 34, in print_blob_acl
with storage_client.batch():
File "/root/connectorDevelopment/GCP/batch/lib/python3.10/site-packages/google/cloud/storage/batch.py", line 286, in __exit__
self.finish()
File "/root/connectorDevelopment/GCP/batch/lib/python3.10/site-packages/google/cloud/storage/batch.py", line 256, in finish
headers, body, timeout = self._prepare_batch_request()
File "/root/connectorDevelopment/GCP/batch/lib/python3.10/site-packages/google/cloud/storage/batch.py", line 202, in _prepare_batch_request
raise ValueError("No deferred requests")
ValueError: No deferred requests

Making sure to follow these steps will guarantee the quickest resolution possible.

Do let me know if I've missed any detail.
Thanks!

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/python-storage API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions