python - 尝试从 GCS 存储桶获取视频(blob)对象的元数据时出现 ValueError
问题描述
运行此 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
存储在桶中的所有对象都是视频文件。
如何获取存储桶中存储的视频文件的元数据。
提前致谢。
解决方案
谢谢大家 我发现问题了
storage_client = storage.Client()
bucket = storage_client.bucket('bucket_name')
blob1 = bucket.get_blob(blob.name)
print(blob1.name)
而不是 blob 对象,我应该通过 blob.name 来获取该对象的元数据
推荐阅读
- javascript - How to use promise.allSettled with typescript?
- android - removeObserver 不工作,观察者一直在执行
- reactjs - 如何制作动态反应进度条
- css - 您可以为类组合创建 CSS/SCSS 规则吗?
- label - 博主热门帖子添加标签不起作用
- java - 您能否向我解释为什么下界通配符在我的示例中不起作用?
- html - Chrome 更新后显示 html-tag Legend 的问题
- sql-server - 如何从每个日期获取第一个(datetime2 数据类型)值?
- postgresql - GCP Cloud Run with PostgreSQL - 如何进行迁移?
- julia - 对于集合(不可变)和字符串(可变),“===”的行为似乎不符合 Julia 中的文档(至少 v1.5)