Google cloud storage 使用python在Google云存储中创建文件

Google cloud storage 使用python在Google云存储中创建文件,google-cloud-storage,Google Cloud Storage,这是我用来在Google云存储中保存新文件的方法 cloud_storage_path = "/gs/[my_app_name].appspot.com/%s/%s" % (user_key.id(), img_title) blobstore_key = blobstore.create_gs_key(cloud_storage_path) cloud_storage_file = cloudstorage_api.open( filename=cloud_st

这是我用来在Google云存储中保存新文件的方法

cloud_storage_path = "/gs/[my_app_name].appspot.com/%s/%s" % (user_key.id(), img_title)
    blobstore_key = blobstore.create_gs_key(cloud_storage_path)
    cloud_storage_file = cloudstorage_api.open(
        filename=cloud_storage_path, mode="w", content_type=img_type
    )
    cloud_storage_file.write(img_content)
    cloud_storage_file.close()
但当执行此方法时。打印的日志文件:

Path should have format /bucket/filename but got /gs/[my_app_name].appspot.com/6473924464345088/background.jpg
注:我更改了[我的应用程序名称]和[我的应用程序名称]。appspot.com是我的bucket名称

那么,在这种情况下,我下一步要做什么?
我无法将文件保存到该路径

您是否尝试删除“/gs”?我删除了,但出现了以下错误:`文件名必须以“/gs/”开头:/[my_app_name].appspot.com/6473924464345088/background.jpgHrm…如果没有最后一个“/”,它是否工作?也许那需要逃避?我试了很多方法但总是失败你找到方法了吗?我正在尝试将文件写入其中,但似乎没有任何效果您是否尝试删除“/gs”?我尝试了,但出现了此错误:`文件名必须以“/gs/”开头:/[my_app_name].appspot.com/6473924464345088/background.jpgHrm…如果没有最后一个“/”,它是否工作?也许那需要逃避?我试了很多方法但总是失败你找到方法了吗?我正试图将文件写入其中,但似乎没有任何效果