GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — In storage.Key.get_contents_to_filename, improve error checking and exception handling and add timestamp to file object · Issue #148 · googleapis/google-cloud-python

In storage.Key.get_contents_to_filename, improve error checking and exception handling and add timestamp to file object #148

New issue
Copy link
New issue
Copy link
Closed
#320
Closed
In storage.Key.get_contents_to_filename, improve error checking and exception handling and add timestamp to file object#148
#320
Copy link
Assignees
tseaver
Labels
🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.
Milestone
Storage Stable

Description

@dhermes
dhermes
opened on Sep 22, 2014
Issue body actions

From TODO:

    # TODO: Add good error checking.
    # TODO: Add good exception handling.
    # TODO: Set timestamp? Make optional, default being to set it if possible?

Also, consider renaming get_contents_to_filename and get_contents_to_file. The get is a misleading verb, since a read into a file is what is happening.

See gcloud.storage.Key.get_contents_to_filename for relevant code and #146 for some context.

Activity

Next
  1. dhermes commented on Sep 22, 2014

    @dhermes
    dhermes
    on Sep 22, 2014
    ContributorAuthor
    More actions

    git blame output

    b7f1b774 (JJ Geewax   2014-01-29 18:02:29 -0500 169)     # TODO: Add good error checking.
    b7f1b774 (JJ Geewax   2014-01-29 18:02:29 -0500 170)     # TODO: Add good exception handling.
    b7f1b774 (JJ Geewax   2014-01-29 18:02:29 -0500 171)     # TODO: Set timestamp? Make optional, default being to set it if possible?
    
  2. tseaver
    added
    api: storageIssues related to the Cloud Storage API.
    on Sep 22, 2014
  3. silvolu
    added this to the This milestone has been deleted milestone on Sep 24, 2014
  4. tseaver commented on Oct 28, 2014

    @tseaver
    tseaver
    on Oct 28, 2014
    Contributor
    More actions

    @jgeewax WRT raising / handling errors: the open() call will raise IOError on failure: ISTM that we can just let that error propagate, as with any error raised by self.get_contents_to_file().

    WRT the timestamp: we open the file in 'wb' mode, which will cause its mtime to be updated by the OS. Are you suggesting that we set the timestamp to a different value (e.g., based on some metadata?) We aren't saving any such metadata when uploading.

  5. jgeewax commented on Oct 29, 2014

    @jgeewax
    jgeewax
    on Oct 29, 2014
    Contributor
    More actions

    @dhermes : The naming was based on boto's names.

    @tseaver : Re open() call, you mean if the filename is invalid ? i agree it's fine to let that propagate up.. i wouldn't expect that error to get caught.

    Re timestamp: I think my thought was that we could set the last modified time of the local file to the last modified time of the object in GCS. i wouldn't mind if we decided to scrap that all together though...

  6. tseaver commented on Oct 29, 2014

    @tseaver
    tseaver
    on Oct 29, 2014
    Contributor
    More actions

    WRT naming: I would prefer names like save_contents_to_filename and upload_contents_from_filename, which make the directionality unambiguous.

    #311 tracks the enhancement for synchronizing the file's mtime.

  7. silvolu commented on Oct 29, 2014

    @silvolu
    silvolu
    on Oct 29, 2014
    Contributor
    More actions

    WRT naming: I like @tseaver proposal. If we do the change, I think we should make the naming uniform for all the get_contents_* and save_contents_* methods (a total of 6).

  8. jgeewax commented on Oct 30, 2014

    @jgeewax
    jgeewax
    on Oct 30, 2014
    Contributor
    More actions

    Do we have any objections to keeping the old names as aliases ? (And noting those aliases in the docs?)

    I'd like it to be relatively easy to move from boto -> gcloud -- and aliases don't really hurt... right?

  9. tseaver
    closed this as completedin #320on Nov 1, 2014
  10. jgeewax
    modified the milestones: This milestone has been deleted, Storage Stable on Jan 30, 2015
  11. urshala
    added 2 commits that reference this issue on Jan 17, 2020

    Contact: now tracks it's inner state

    This issue will close once commit a785203 is merged into the 'master' branch.
    a785203

    Contact: Fixed googleapis#148

    This issue will close once commit 9941745 is merged into the 'master' branch.
    9941745
  12. 80 remaining items

  13. parthea
    added 11 commits that reference this issue on Nov 24, 2025

    chore: migrate default branch from master to main (#148)

    9dba05a

    docs: explain how to use repeated struct.Value (#148)

    82feb3f

    chore: release 1.26.1 (#148)

    b17b66d

    ci: prototype running lint / mypy / unit tests / coverage as GH actio…

    8a6e42e

    fix: avoid out-of-range nanoseconds field in pandas 1.5.x (#148)

    5598fb9

    chore(python): Enable size-label bot (#148)

    6895c49

    build(deps): [autoapprove] bump certifi from 2022.12.7 to 2023.7.22 (#…

    548ec2a

    build(python): exit with success status if no samples found (#148)

    27b65bc

    chore: Re-generated to pick up changes from synthtool. (#148)

    62ce648

    Implement Global Cache (memcache) (#148)

    395edb5

    Allow customizing the GCE metadata service address via an env var. (#148

    9989339
  14. parthea
    added 4 commits that reference this issue on Mar 6, 2026

    dbapi: fix "Column not found" error when inserting rows with quoted c…

    This issue will close once commit 7de4c45 is merged into the 'main' branch.
    7de4c45

    feat: add support for Point In Time Recovery (PITR) (#148)

    This issue will close once commit d424356 is merged into the 'main' branch.
    d424356

    test: fix PITR restored database version time assertion (#238)

    This issue will close once commit 593b54a is merged into the 'main' branch.
    593b54a

    chore: release 1.3.1 (#148)

    This issue will close once commit bb98200 is merged into the 'main' branch.
    bb98200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    • Storage Stable

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.