3

I'm trying to mount my drive on Colab using the following code:

from google.colab import drive
drive._mount('/content/drive')

And I'm getting the following error:

298       # Terminate the DriveFS binary before killing bash.

ValueError: mount failed: invalid oauth code

Tried deleting cookies, restarting the session, but nothing seems to work. I am using a few different google accounts, and only one has a Colab Pro subscription.. but this wasn't an issue till today.

Thanks.

zyezye11
  • 47
  • 1
  • 9
  • 1
    These posts have to go up. Google is messing up with the Colab Drive mounting once again. This is bad, really bad for all of us, most of all, for students. – mascIT Jan 21 '22 at 09:49
  • Exactly. I don't even know how to terminate the drive's binary. Tried everything, did not work. Crazy that it's still ongoing. – zyezye11 Jan 21 '22 at 15:07

2 Answers2

0

for the moment the only solution that is working right now is this from this similar question but two months ago:

!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}
%cd /content
!mkdir drive
%cd drive
!mkdir MyDrive
%cd ..
%cd ..
!google-drive-ocamlfuse /content/drive/MyDrive

Let's hope the normal way drive.mount will be fixed soon !

0

Here is the solution you can try:

As of new (messed up) update you can not mount using drive._mount anymore (or at least for now). So what you can do is either copy your folder/directory from your other google drive to your current google drive (the account you are log in to colab with) OR you can simply log out from colab and log in with your google account that has the drive you want to mount to

Remember use drive.mount and not drive._mount after following the above guideline

Omair Munir
  • 135
  • 8