Create an external file in Google Colab Notepad.

Reference: How to upload a file and read Google Colab

  1. Put the tool first:google-drive-ocamlfuse

    !apt-get install -y -qq software-properties-common python-software-properties module-init-tools
    !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
    !apt-get update -qq 2>&1 > /dev/null
    !apt-get -y install -qq google-drive-ocamlfuse fuse
    from google.colab import auth
    auth.authenticate_user()
    from oauth2client.client import GoogleCredentials
    creds = GoogleCredentials.get_application_default()
    import getpass
    !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
    vcode = getpass.getpass()
    !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
    
  2. Go to the web page to confirm:

    Confirm the authentication of this access. Follow the command that says open link, and you will visit some blue page showing your key. *

  3. Re-mount

    !mkdir drive
    !google-drive-ocamlfuse drive
    !ls drive/"Colab Notebooks"
    

this is good.

Leave a Comment