Aman Swarnkar
Aman Swarnkar

Reputation: 68

Getting ValueError when trying to get video (blob) object's metadata from GCS bucket

When running this python script

storage_client = storage.Client()
bucket = storage_client.bucket('bucket_name')
blob1 = bucket.get_blob(blob)
print(blob1.name)

getting the following error:

ValueError: <Blob: bucket-name, /videos/batch1TestingVideo1/video1.mp4, 1600346932097827> 
could not be converted to unicode

All objects stored in the bucket are video files.

How to get metadata of stored video files in the bucket.

Thanks in advance.

Upvotes: 0

Views: 480

Answers (1)

Aman Swarnkar
Aman Swarnkar

Reputation: 68

Thanks guys I figured out the problem

storage_client = storage.Client()
bucket = storage_client.bucket('bucket_name')
blob1 = bucket.get_blob(blob.name)
print(blob1.name)

instead of blob object, I should have passed blob.name to get metadata of that object

Upvotes: 1

Related Questions