First off, Google Cloud Storage is not Blobstore. You can create a key for use with Blobstore with blobstore.create_gs_key(), but you should only do this if you really need to use Blobstore API for something (eg. with the Images API). You should not treat Blobstore and GCS as the same thing or intermingle them needlessly.
So adding to that, GCS doesn't understand or care about blob keys <https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/functions>, so gcs.delete(key) won't work. Objects that are uploaded to Blobstore don't necessarily exist in GCS, so there isn't a way to get a GCS file name from a blob key*. You need to use the GCS file path directly, eg. gcs.delete('/mybucket/path/to/myobject'). So to avoid this type of problem you should always use 'cloudstorage' and deal with objects in terms of GCS files, using blobstore.create_gs_key() only when you need to use some function that needs the Blobstore API. You can make Blobstore talk to GCS, but not the other way around. ** The filename you get from BlobInfo <https://cloud.google.com/appengine/docs/python/refdocs/google.appengine.ext.blobstore.blobstore#google.appengine.ext.blobstore.blobstore.BlobInfo> is the filename from the user's machine when they uploaded the blob, not the filename in GCS.* On Saturday, April 16, 2016 at 5:22:07 PM UTC-4, Juan Antonio Fernández Sánchez wrote: > > I'm saving images in cloudstore (blobstore) using 'cloudstorage' library > in python. > > Well, this images are the image profile from users and I get the url from > blobstore to save this with the rest of data of user. > And now I' m trying develop the way to erase this files using the same url > that I have saved in the data block of users, but I dont find a simple way > to do this with the 'cloudstorage' library. > > I could save the filename of the photos of users in DB togheter to url to > access faster, but I prefer know how I can could make this. > > Thanks you so much for help. > > Code example that I want more o less: > > def DeleteFile(self, url): > key = keyFromUrl(url) > gcs.delete(key) > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/d47d22ab-ba5a-4064-b24d-aab73ff5f5d7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
