Images from Google Cloud Storage no longer appear after GAE 1.8.8 update

After upgrading to GAE 1.8.8 and the GCS client to r127, my code that displays images no longer works using a development or production server. The code that worked previously through the following development error:

Blob with key 'encoded_gs_file:blahblahblah' does not exist

Please note: blahblahblah is just my short string for a long string.

Below is a way to create my url. This has always worked in the past.

bkey = blobstore.create_gs_key('/gs/mybucket/myfile.jpg')
url = images.get_serving_url(bkey, size=170, crop=True, secure_url=True)

The following is a stack trace from the development server:

ERROR    2013-11-21 20:35:31,767 images_stub.py:405] Blob with key 'encoded_gs_file:c2l0ZS1hdWRpdC1waW5uYWNsZWNyZS9CYXR0ZXJ5L3Bob3Rvcy8yMDEzMTEyMTAwMTEyOUBhNzllYmQwNC05YWY3LTRhMWItYTg3My1mZGIwYjI5MjNjNzguanBn' does not exist
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/images/images_stub.py", line 401, in _OpenBlob
blobstore_stub.BlobstoreServiceStub.ToDatastoreBlobKey(blob_key))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 651, in Get
return GetAsync(keys, **kwargs).get_result()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 612, in get_result
return self.__get_result_hook(self)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1541, in __get_hook
entities = extra_hook(entities)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 620, in local_extra_hook
raise datastore_errors.EntityNotFoundError()
EntityNotFoundError
ApplicationError(1,)

Reading Release Notes for GAE 1.8.8 I don't see anything I need to change in my code. Any directions regarding what I am doing wrong would be great.

+4
1

. , . @ . urllib2.quote(), . blob. . , - .

filename = urllib2.quote('/gs/bucket/file@name.jpg')
bkey = blobstore.create_gs_key(filename)
url = images.get_serving_url(bkey, size=170, crop=True, secure_url=True)

1:

, urllib2.quote() dev-. . , - , , , .

filename = '/gs/bucket/file@name.jpg'
if (os.getenv('SERVER_SOFTWARE') and not os.getenv('SERVER_SOFTWARE').startswith('Google App Engine/')):
    filename = urllib2.quote(filename)
bkey = blobstore.create_gs_key(filename)
url = images.get_serving_url(bkey, size=170, crop=True, secure_url=True)

2:

, . , . - , . , stackoverflow, .

urllib2.quote, - . , , . try, , , .

try:
    filename = urllib2.quote('/gs/bucket/file@name.jpg')
    bkey = blobstore.create_gs_key(filename)
    url = images.get_serving_url(bkey, size=170, crop=True, secure_url=True)
except:
    filename = '/gs/bucket/file@name.jpg'
    bkey = blobstore.create_gs_key(filename)
    url = images.get_serving_url(bkey, size=170, crop=True, secure_url=True)

, :

/gs/bucket/20131124212800%40491524ca-8044-4a42-9fba-13b98352f730.jpg
/gs/bucket/20131124190014%40d8d318ee-1308-4711-9f54-9b1cd7d14d96.jpg

, :

/gs/bucket/20131122170644%4028a4c1d8-7163-43fe-bc30-d35bf4f415cb.jpg
/gs/bucket/20131121154114%4043bb3dfc-ae84-4583-9f4d-24bbba459f19.jpg

, , :

/gs/bucket/20131122170644@28a4c1d8-7163-43fe-bc30-d35bf4f415cb.jpg
/gs/bucket/20131121154114@43bb3dfc-ae84-4583-9f4d-24bbba459f19.jpg

, - , , . .

+1

All Articles