Skip to content

Instantly share code, notes, and snippets.

@abhiTronix
Last active September 27, 2018 07:00
Show Gist options
  • Save abhiTronix/919a9eea16abc1ff80feda3ae15b9b6d to your computer and use it in GitHub Desktop.
Save abhiTronix/919a9eea16abc1ff80feda3ae15b9b6d to your computer and use it in GitHub Desktop.
Colab to google drive connection (update september,2018)
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools libfuse2
#!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
!wget https://launchpad.net/~alessandro-strada/+archive/ubuntu/google-drive-ocamlfuse-beta/+build/15331130/+files/google-drive-ocamlfuse_0.7.0-0ubuntu1_amd64.deb
!dpkg -i google-drive-ocamlfuse_0.7.0-0ubuntu1_amd64.deb
!apt-get install -f
!apt-get -y install -qq 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}
!mkdir -p drive
!google-drive-ocamlfuse drive
import os
os.chdir("/content/drive/")
!ls
@abhiTronix
Copy link
Author

packages removed for zesty and artful, since they have reached end of life
So i updated the script, Thankyou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment