Blob.download_to_file not working on Compute Engine

106 views
Skip to first unread message

Samuli Kuusisto

unread,
Dec 5, 2018, 9:40:56 AM12/5/18
to gce-discussion

Blob.download_to_file is not working on my Compute Engine instance. The blob is succesfully loaded, but code execution fails where asterisk * is in the following code block:

    from google.cloud import storage

    gcs = storage.Client()
    bucket = gcs.get_bucket('bucket_name')
    shp_blob = bucket.blob(shapeFile +".shp")
    with open('/tmp/shp-file', 'w+') as self.shp_file:
        logger.log_text('success2.3')
        shp_blob.download_to_file(self.shp_file)*
    logger.log_text('success2.4')

Please help! This same code used to work in App Engine. I'm using Linux Debian VM (Compute Engine) + nginx + gunicorn + flask REST API, and in one of the endpoints above mentioned happens. I followed this tutorial whit slight modification when I setup the server.

Message has been deleted

Justin Reiners

unread,
Dec 5, 2018, 10:57:44 AM12/5/18
to samuli....@gmail.com, gce-dis...@googlegroups.com
are you using a key? if not, you might need to add full storage permissions to the compute instance.

--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/680fb7c0-edfa-4086-9d83-ac1976d3f1b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Justin Reiners

Samuli Kuusisto

unread,
Dec 5, 2018, 11:42:44 AM12/5/18
to gce-discussion
I am using a key..still it doesn't work. If I run the same code in a separate test file without server, it works.
Reply all
Reply to author
Forward
0 new messages