Skip to content

blob.download_to_filename() broken with 0.27.0 #3841

Closed

Description

@tcroiset

I open the bug here since it's linked to the new release 0.27.0 (urrlib2 -> requests), though it crashes in dependency google-resumable-media-python

  File "/home/tristan/p/api/api/utilities/storage.py", line 21, in get_gcs_blob
    blob.download_to_filename(local_path)
  File "/home/tristan/env/api/local/lib/python2.7/site-packages/google/cloud/storage/blob.py", line 482, in download_to_filename
    self.download_to_file(file_obj, client=client)
  File "/home/tristan/env/api/local/lib/python2.7/site-packages/google/cloud/storage/blob.py", line 464, in download_to_file
    self._do_download(transport, file_obj, download_url, headers)
  File "/home/tristan/env/api/local/lib/python2.7/site-packages/google/cloud/storage/blob.py", line 418, in _do_download
    download.consume(transport)
  File "/home/tristan/env/api/local/lib/python2.7/site-packages/google/resumable_media/requests/download.py", line 101, in consume
    self._write_to_stream(result)
  File "/home/tristan/env/api/local/lib/python2.7/site-packages/google/resumable_media/requests/download.py", line 62, in _write_to_stream
    with response:
AttributeError: __exit__

Activity

  1. dhermes commented on Aug 18, 2017

    @dhermes
    Contributor

    @tcroiset Thanks for reporting. I'm sorry to say this is the third or fourth such report (100% my fault this error is occurring).

    The simple fix: make sure requests >= 2.18.0. We have releases google-cloud-storage==1.3.2 (via #3814) to ensure the minimum version.

    Sorry for the inconvenience.

  2. added
    api: storageIssues related to the Cloud Storage API.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Aug 18, 2017
  3. kparaju commented on Mar 7, 2018

    @kparaju

    I had to uninstall requests 2.18.4 (pip uninstall requests) and install 2.18.0 (pip install requests==2.18.0) to make it work

  4. jasonmellone commented on Sep 6, 2020

    @jasonmellone

    Still getting this as of date posting. Shouldn't https://anaconda.org/conda-forge/google-cloud-storage solve for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.status: duplicateDuplicate.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions