0

I am trying to run a Python script on files in Google Cloud Storage (without using the google-cloud-storage package). I have Jupyter running on a VM instance. How can I access my files from Jupyter? this is an example of the code I'm trying to run:

    fileName = 'OUTCAR'

    with open(fileName) as file:
        for line in file:
            if 'free  energy   TOTEN' in line:
                print(line)
Firestarter
  • 86
  • 1
  • 11
  • Hi @Firestarter can you share minimal reproducible code sample to better understand what do you want to achieve? Why you do want not use [google-cloud-storage that is well documented here](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/storage)? – Pawel Czuczwara Jul 18 '19 at 09:22
  • google-cloud-storage doesn't allow me to run basic python scripts without using their storage client code. I added the code I'm trying to run. – Firestarter Jul 18 '19 at 13:30
  • Files on GCS are not local to your VM instance so you have to download them first. – Alessandro Jul 18 '19 at 13:42
  • Okay. That's what I was trying to avoid doing. Guess I'll have to find another way. – Firestarter Jul 18 '19 at 13:43

1 Answers1

2

After the last comment, I might know what you can do. At the end, it comes to what you want to try to do. To "see" a bucket as a local volume, you could use gcsfue to mount GCS as volume on your VM. At that point you will see files as local. However they are not really local file gcsfue manages downlaod, upload, and update for you.

Alessandro
  • 609
  • 1
  • 4
  • 8