I have files that have been uploaded using the gcloud command line interface with the -z flag which applies gzip content-encoding on files during transfer.
gcloud -m cp -z text gs://<bucket>
It appears that running the blob.download_to_file() and blob.download_to_string() raise a httplib2.FailedToDecompressContent exception on about 10% of the files.
Traceback (mostrecentcalllast):
File"manage.py", line10, in<module>execute_from_command_line(sys.argv)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line354, inexecute_from_command_lineutility.execute()
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line346, inexecuteself.fetch_command(subcommand).run_from_argv(self.argv)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/django/core/management/base.py", line394, inrun_from_argvself.execute(*args, **cmd_options)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/django/core/management/base.py", line445, inexecuteoutput=self.handle(*args, **options)
File"/Users/sanghan/Projects/memexcadastre/download/management/commands/download.py", line44, inhandlefile.download_to_filename(filename)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/gcloud/storage/blob.py", line329, indownload_to_filenameself.download_to_file(file_obj, client=client)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/gcloud/storage/blob.py", line314, indownload_to_filedownload.initialize_download(request, client._connection.http)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/gcloud/streaming/transfer.py", line347, ininitialize_downloadself.bytes_httporhttp, http_request)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/gcloud/streaming/http_wrapper.py", line405, inmake_api_requestcheck_response_func=check_response_func)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/gcloud/streaming/http_wrapper.py", line353, in_make_api_request_no_retryredirections=redirections, connection_type=connection_type)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/oauth2client/client.py", line622, innew_requestredirections, connection_type)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/httplib2/__init__.py", line1609, inrequest
(response, content) =self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/httplib2/__init__.py", line1351, in_request
(response, content) =self._conn_request(conn, request_uri, method, body, headers)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/httplib2/__init__.py", line1337, in_conn_requestcontent=_decompressContent(response, content)
File"/Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages/httplib2/__init__.py", line410, in_decompressContentraiseFailedToDecompressContent(_("Content purported to be compressed with %s but failed to decompress.") %response.get('content-encoding'), response, content)
httplib2.FailedToDecompressContent: Contentpurportedtobecompressedwithgzipbutfailedtodecompress.Here is some context on the platform I'm running this on.
>>>importpkg_resources>>>pkg_resources.get_build_platform()
'macosx-10.11-x86_64'
$ pip show gcloud
Metadata-Version: 2.0
Name: gcloud
Version: 0.12.0
Summary: API Client library for Google Cloud
Home-page: https://github.com/GoogleCloudPlatform/gcloud-python
Author: Google Cloud Platform
Author-email: jjg+gcloud-python@google.com
Installer: pip
License: Apache 2.0
Location: /Users/sanghan/Projects/memexcadastre/venv/lib/python2.7/site-packages
Requires: pyOpenSSL, six, httplib2, protobuf, oauth2client, googleapis-common-protos
$ python --version
Python 2.7.11
The files that do decompress correctly seem to be successful in decompressing, but the ones that fail also fail every time. This also seems to be filesize independent as I have both large and files successfully decompress on download.
Thanks!
I have files that have been uploaded using the gcloud command line interface with the
-zflag which applies gzip content-encoding on files during transfer.gcloud -m cp -z text gs://<bucket>It appears that running the
blob.download_to_file()andblob.download_to_string()raise ahttplib2.FailedToDecompressContentexception on about 10% of the files.Here is some context on the platform I'm running this on.
The files that do decompress correctly seem to be successful in decompressing, but the ones that fail also fail every time. This also seems to be filesize independent as I have both large and files successfully decompress on download.
Thanks!