GCP App Engine: OSError: [Errno 30] Read-only file system:

GCP App Engine: OSError: [Errno 30] Read-only file system:

我在 GCP 应用引擎上部署了一个 Flask 应用程序,我用它来将文件上传到 GCP 存储桶存储,然后在需要时从存储中下载文件。但是,当我尝试从云存储下载文件时遇到错误 OSError: [Errno 30] Read-only file system:。我可以从部署在 App Engine 上的应用程序正确上传文件,并且我验证了文件已上传,但是当我尝试从网站下载时出现错误。任何想法将不胜感激?

从桶中下载文件的代码

 storage_client = storage.Client()

 bucket = storage_client.bucket(bucket_name)
 blob = bucket.blob(source_blob_name)
 blob.download_to_filename(destination_file_name)

PS:我正在使用 google-cloud-storage==1.33.0

App Engine 中没有可写硬盘,如果您需要写入临时文件,请使用 /tmp 文件夹,如 here 所述。不要忘记删除它以释放系统的 RAM,否则它会在某些时候崩溃。