Md. Parvez Alam
Md. Parvez Alam

Reputation: 4596

unable to read csv using panda from local

I have below code to read csv which is working from cloud function

import pandas as pd   
        file_name = "gs://" + "bucket_name" + "/" + name
        print(file_name)
        pd.read_csv(file_name, sep=',')

But above code is not working from local, throwing error

_request out of retries on exception: Cannot connect to host storage.googleapis.com:443 ssl:True

I have tried with ping and its resonding...

I have also set GOOGLE_APPLICATION_CREDENTIALS

set GOOGLE_APPLICATION_CREDENTIALS = project-name-xxxxx.json

Still its not working.

I am able to get list of files from google storage, but unable to read data through pandas

Any help

Thanks

Upvotes: 1

Views: 213

Answers (1)

Turgut
Turgut

Reputation: 819

Try running gcloud auth activate-service-account --key-file project-name-xxxxx.json before GOOGLE_APPLICATION_CREDENTIALS = project-name-xxxxx.json and make sure that you are mounting using the propper gcsfuse commands.

Also if you are not using a variable you don't need to use separate strings so just write file_name = "gs://bucket_name/" + name or remove quotation marks: file_name = "gs://" + bucket_name + "/" + name

Upvotes: 1

Related Questions