【问题标题】:Getting ValueError when trying to get video (blob) object's metadata from GCS bucket尝试从 GCS 存储桶获取视频(blob)对象的元数据时出现 ValueError
【发布时间】:2021-01-04 09:22:35
【问题描述】:

当运行这个 python 脚本时

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

得到以下错误:

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

bucket中存储的所有对象都是视频文件。

如何获取存储桶中存储的视频文件的元数据。

提前致谢。

【问题讨论】:

    标签: python google-cloud-platform google-cloud-storage blobstore bucket


    【解决方案1】:

    谢谢大家,我发现了问题

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

    我应该传递 blob.name 而不是 blob 对象来获取该对象的元数据

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-10
      • 1970-01-01
      • 2017-08-16
      • 2017-04-06
      • 2020-04-27
      • 2016-11-01
      • 2023-02-14
      相关资源
      最近更新 更多