You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/opt/conda/envs/py27/lib/python2.7/site-packages/google/cloud/storage/blob.pyc in _do_download(self, transport, file_obj, download_url, headers)
416 if self.chunk_size is None:
417 download = Download(download_url, stream=file_obj, headers=headers)
--> 418 download.consume(transport)
419 else:
420 download = ChunkedDownload(
/opt/conda/envs/py27/lib/python2.7/site-packages/google/resumable_media/requests/download.pyc in consume(self, transport)
99
100 if self._stream is not None:
--> 101 self._write_to_stream(result)
102
103 return result
/opt/conda/envs/py27/lib/python2.7/site-packages/google/resumable_media/requests/download.pyc in _write_to_stream(self, response)
60 response (~requests.Response): The HTTP response object.
61 """
---> 62 with response:
63 body_iter = response.iter_content(
64 chunk_size=_SINGLE_GET_CHUNK_SIZE, decode_unicode=False)
AttributeError: exit
The text was updated successfully, but these errors were encountered:
#3841 has no explanation and requests is up to date
import requests
print (requests.version)
2.14.2
deepdad
changed the title
__exit__ without further info when doanloading gzipped file
__exit__ without further info when downloading gzipped file
Sep 10, 2017
def download_blob(bucket_name, source_blob_name, destination_file_name):
#Downloads a blob from the bucket.
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(source_blob_name)
print(bucket.exists(client=storage_client))
print(bucket.get_blob(blob_name=source_blob_name))
with open(destination_file_name, 'wb') as file_obj:
blob.download_to_file(file_obj=file_obj)
#blob.download_to_filename(destination_file_name)
download_blob('test-ml-storage', 'deepdad/sample.tar.gz', './sample.tar.gz')
AttributeErrorTraceback (most recent call last)
in ()
20 destination_file_name))
21
---> 22 download_blob('test-ml-storage', 'deepdad/sample.tar.gz', './sample.tar.gz')
in download_blob(bucket_name, source_blob_name, destination_file_name)
13 print(bucket.get_blob(blob_name=source_blob_name))
14 with open(destination_file_name, 'wb') as file_obj:
---> 15 blob.download_to_file(file_obj=file_obj)
16 #blob.download_to_filename(destination_file_name)
17
/opt/conda/envs/py27/lib/python2.7/site-packages/google/cloud/storage/blob.pyc in download_to_file(self, file_obj, client)
462
463 try:
--> 464 self._do_download(transport, file_obj, download_url, headers)
465 except resumable_media.InvalidResponse as exc:
466 _raise_from_invalid_response(exc)
/opt/conda/envs/py27/lib/python2.7/site-packages/google/cloud/storage/blob.pyc in _do_download(self, transport, file_obj, download_url, headers)
416 if self.chunk_size is None:
417 download = Download(download_url, stream=file_obj, headers=headers)
--> 418 download.consume(transport)
419 else:
420 download = ChunkedDownload(
/opt/conda/envs/py27/lib/python2.7/site-packages/google/resumable_media/requests/download.pyc in consume(self, transport)
99
100 if self._stream is not None:
--> 101 self._write_to_stream(result)
102
103 return result
/opt/conda/envs/py27/lib/python2.7/site-packages/google/resumable_media/requests/download.pyc in _write_to_stream(self, response)
60 response (~requests.Response): The HTTP response object.
61 """
---> 62 with response:
63 body_iter = response.iter_content(
64 chunk_size=_SINGLE_GET_CHUNK_SIZE, decode_unicode=False)
AttributeError: exit
The text was updated successfully, but these errors were encountered: