You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用gsutil迁移视频至GCS时遇ResumableUploadException报错求助

问题

我需要把公司的视频存档从Google Drive迁移到Google Cloud归档存储桶,本人对gsutil和Google Colaboratory经验不多,最终选了Colab Pro(支持24小时运行),用gsutil来操作,参考了Philipp Lies的方案:

挂载Google Drive

from google.colab import drive
drive.mount('/content/drive')

认证并配置GCP项目

from google.colab import auth
auth.authenticate_user()

project_id = 'my-project-id'
!gcloud config set project {project_id}
!gsutil ls

执行迁移命令

bucket_name = 'my-bucket-name'

!gsutil -m cp -r -n -L manifest.txt /my/drive/directory/* gs://{bucket_name}/

执行时控制台报错:'ResumableUploadException' object has no attribute 'message',触发错误的文件无法复制到目标存储桶,求解决办法。

解决办法

  • 禁用断点续传模式:在gsutil命令中添加参数强制关闭断点续传,绕过异常处理的bug。修改后的命令:
    !gsutil -m -o GSUtil:parallel_composite_upload_threshold=0 cp -r -n -L manifest.txt /my/drive/directory/* gs://{bucket_name}/
    
  • 更新gsutil版本:Colab默认的gsutil可能存在版本旧的问题,执行以下命令更新到最新版:
    !gcloud components update gsutil
    
  • 拆分迁移任务:将批量迁移拆分为多个小任务,比如按文件大小或文件夹分批处理,避免单个文件异常影响整个迁移流程。
  • 检查文件权限:确认触发错误的视频文件在Google Drive中拥有完整的读取权限,权限不足可能导致上传过程中出现异常。

内容的提问来源于stack exchange,提问作者Latent-code

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 22:57:08