I am trying to replace a file that exists on Google storage.

This is the code I am using:

        write_path = files.gs.create(filename= _file_name,
                        acl='public-read',
                        mime_type=mime,
                        cache_control='Expires=' + expiresDate.strftime(
formatStr))

        logging.debug('write_path = ' + write_path)

        # Write to the file.
        
#http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/files/file.py#402
        with files.open(write_path, 'a', exclusive_lock=True) as fp:
            fp.write(imageBytes)

        # Finalize the file so it is readable in Google Cloud Storage.
        files.finalize(write_path)
 
I am getting the following exception:

Traceback (most recent call last):
  File 
\\"/base/data/home/apps/s~redacted/dev-v2.359923243624465743/processImageBatch.py\\",
 
line 204, in handle_result
    self._store_zimages( bucketName, url, imageId, code, imageType, 
response.content)
  File 
\\"/base/data/home/apps/s~redacted/dev-v2.359923243624465743/processImage.py\\",
 
line 136, in _store_zimages
    self.cloudfile_write( bucketName, imageId, self._get_short_photo_path( 
imageId, \'s\', \'a\', code = code,ext=urlext), imageBytes)
  File 
\\"/base/data/home/apps/s~redacted/dev-v2.359923243624465743/processImage.py\\",
 
line 639, in cloudfile_write
    self.gfile_write ( bucketName, str(imageId), filePath,imageBytes,mime)
  File 
\\"/base/data/home/apps/s~redacted/dev-v2.359923243624465743/processImage.py\\",
 
line 626, in gfile_write
    with files.open(write_path, \'a\', exclusive_lock=True) as fp:
  File 
\\"/base/python27_runtime/python27_lib/versions/1/google/appengine/api/files/file.py\\",
 
line 496, in open
    exclusive_lock=exclusive_lock)
  File 
\\"/base/python27_runtime/python27_lib/versions/1/google/appengine/api/files/file.py\\",
 
line 274, in __init__
    self._open()
  File 
\\"/base/python27_runtime/python27_lib/versions/1/google/appengine/api/files/file.py\\",
 
line 421, in _open
    self._make_rpc_call_with_retry(\'Open\', request, response)
  File 
\\"/base/python27_runtime/python27_lib/versions/1/google/appengine/api/files/file.py\\",
 
line 425, in _make_rpc_call_with_retry
    _make_call(method, request, response)
  File 
\\"/base/python27_runtime/python27_lib/versions/1/google/appengine/api/files/file.py\\",
 
line 250, in _make_call
    _raise_app_error(e)
  File 
\\"/base/python27_runtime/python27_lib/versions/1/google/appengine/api/files/file.py\\",
 
line 175, in _raise_app_error
    raise ExistenceError()
ExistenceError

--
This was not happening before. Has anything regressed?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/UHuV9KbRVdQJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to