0

I'm running a code on Google colab and I ran into an authentication problem when I mount my google drive. I didn't have any authentication or mounting problem until now, but it stopped working all of a sudden. I don't recall any changes I made to my google account and I can access to my google drive just fine. I tested my code on Google colab with other person's account and it seems to work fine. So I'm guessing it's related to my google account. Anyone had a similar issue or has an idea what could've messed up this authentication?

Here's part of my code for authentication:

And this is where it's stuck and doesn't go through. (after I click the link and choose which google drive to use)

Thanks in advance.

Anwarvic
  • 12,156
  • 4
  • 49
  • 69
linnea
  • 1
  • The second screenshot doesn't show any particular error. Does an error appear? Does the indeterminate progress bar keep spinning? Is there an error logged in the [Javascript console](https://developers.google.com/web/tools/chrome-devtools#console) – Bob Smith Sep 24 '19 at 01:37
  • It didn't give me any error but the progress bar just kept spinning. I tried again today and it started working all of a sudden although I didn't change anything.. I'm glad that it's working now but I'm still wondering what the problem was so that I can fix it when it happens again. – linnea Sep 24 '19 at 21:58

1 Answers1

1

I don't recommend using PyDrive when authenticating Google Colab, you can use this instead:

from google.colab import drive

drive.mount('/content/gdrive')
ROOT = "/content/gdrive/My Drive/"

Now ROOT is the root directory of your Google drive. That's why I always follow this code with:

import os
os.chdir(ROOT)

Now, you can access your GoogleDrive the same as you do with your local disk.

Source: official documentation

Anwarvic
  • 12,156
  • 4
  • 49
  • 69