SUPER new to Google Cloud
I'm trying to access my data that is stored on the Google cloud storage.
I have Google Cloud SDK open one one screen to log in and VScode in another.
Here are my admin permissions.
This is a test dataset and open source so I don't mind granting all users:
Here the example code from the Google Docs:
from google.cloud import storage
def download_blob(bucket_name, source_blob_name, destination_file_name):
"""Downloads a blob from the bucket."""
# The ID of your GCS bucket
# bucket_name = "your-bucket-name"
# The ID of your GCS object
# source_blob_name = "storage-object-name"
# The path to which the file should be downloaded
# destination_file_name = "local/path/to/file"
storage_client = storage.Client(project="cse6242team12project")
bucket = storage_client.bucket(bucket_name)
# Construct a client side representation of a blob.
# Note `Bucket.blob` differs from `Bucket.get_blob` as it doesn't retrieve
# any content from Google Cloud Storage. As we don't need additional data,
# using `Bucket.blob` is preferred here.
blob = bucket.blob(source_blob_name)
blob.download_to_filename(destination_file_name)
print(
"Downloaded storage object {} from bucket {} to local file {}.".format(
source_blob_name, bucket_name, destination_file_name
)
)
I've checked my folder permissions and my destination_file_name
folder named test
is set to "write" when I checked the security permissions under right click-> properties.
What would be the issue? When I called the function download_blob("team12data", "housepricesLA.geojson", "C:/Users")
I still get
PermissionError: [Errno 13] Permission denied: 'C:/Users'
destination_file_name
should be the path to a file (not a directory) where you want the downloaded file to exist. It looks like you're passing a directory, not a file.
Maybe you'll have better results with something like this:
download_blob("team12data", "housepricesLA.geojson", "C:/Users/some_file_name")