title: Error Using Drive Mount with Google Colab
body: <p>I had been working on Colab using:</p>
  <pre class="lang-py prettyprint-override"><code>from google.colab import drive 
  .mount('/content/gdrive')
  
  </code></pre>
  <p>with no problems, until today.</p>
  <p>I don't know why this error was raised:</p>
  <pre class="lang-py prettyprint-override"><code>Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&amp;redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&amp;scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly&amp;response_type=code
  
  Enter your authorization code:
  ··········
  ---------------------------------------------------------------------------
  TIMEOUT                                   Traceback (most recent call last)
  &lt;ipython-input-4-d05fe204dd76&gt; in &lt;module&gt;()
        1 from google.colab import drive
  ----&gt; 2 drive.mount('/content/gdrive')
  
  4 frames
  /usr/local/lib/python3.6/dist-packages/google/colab/drive.py in mount(mountpoint, force_remount, timeout_ms, use_metadata_server)
      223         oauth_prompt,
      224         problem_and_stopped,
  --&gt; 225         drive_exited,
      226     ])
      227     if case == 0:
  
  /usr/local/lib/python3.6/dist-packages/pexpect/spawnbase.py in expect(self, pattern, timeout, searchwindowsize, async_, **kw)
      342         compiled_pattern_list = self.compile_pattern_list(pattern)
      343         return self.expect_list(compiled_pattern_list,
  --&gt; 344                 timeout, searchwindowsize, async_)
      345 
      346     def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1,
  
  /usr/local/lib/python3.6/dist-packages/pexpect/spawnbase.py in expect_list(self, pattern_list, timeout, searchwindowsize, async_, **kw)
      370             return expect_async(exp, timeout)
      371         else:
  --&gt; 372             return exp.expect_loop(timeout)
      373 
      374     def expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1,
  
  /usr/local/lib/python3.6/dist-packages/pexpect/expect.py in expect_loop(self, timeout)
      179             return self.eof(e)
      180         except TIMEOUT as e:
  --&gt; 181             return self.timeout(e)
      182         except:
      183             self.errored()
  
  /usr/local/lib/python3.6/dist-packages/pexpect/expect.py in timeout(self, err)
      142             exc = TIMEOUT(msg)
      143             exc.__cause__ = None    # in Python 3.x we can use &quot;raise exc from None&quot;
  --&gt; 144             raise exc
      145 
      146     def errored(self):
  
  TIMEOUT: &lt;pexpect.popen_spawn.PopenSpawn object at 0x7f58fb7ab4e0&gt;
  searcher: searcher_re:
      0: re.compile('google.colab.drive MOUNTED')
      1: re.compile('root@e7a376888b95-b97a84955c154714b7850ceb4ecf0e8e: ')
      2: re.compile('(Go to this URL in a browser: https://.*)$')
      3: re.compile('Drive File Stream encountered a problem and has stopped')
      4: re.compile('drive EXITED')
  &lt;pexpect.popen_spawn.PopenSpawn object at 0x7f58fb7ab4e0&gt;
  searcher: searcher_re:
      0: re.compile('google.colab.drive MOUNTED')
      1: re.compile('root@e7a376888b95-b97a84955c154714b7850ceb4ecf0e8e: ')
      2: re.compile('(Go to this URL in a browser: https://.*)$')
      3: re.compile('Drive File Stream encountered a problem and has stopped')
      4: re.compile('drive EXITED')
  </code></pre>
  <p>As everyone knows, this code opens a new tab where you have to select a Google account, click on the 'Allow' button, and copy a long password to Colab</p>
  <p><strong>EDIT:</strong></p>
  <p>I tried to do the same in another way with:</p>
  <pre class="lang-py prettyprint-override"><code>#Installing PyDrive
  !pip install PyDrive
  
  #Importing modules
  from pydrive.auth import GoogleAuth
  from pydrive.drive import GoogleDrive
  from google.colab import auth
  from oauth2client.client import GoogleCredentials
  
  #Authenticating and creating the PyDrive client
  auth.authenticate_user()
  gauth = GoogleAuth()
  gauth.credentials = GoogleCredentials.get_application_default()
  drive = GoogleDrive(gauth)
  
  #Getting the file
  downloaded2 = drive.CreateFile({'id':&quot;1QGtoo1wqCP2yrjl8kFu4kTfjWqh3EOdt&quot;})   # replace the id with id of file you want to access
  downloaded2.GetContentFile('estructura_cc_felipe.xlsx') 
  </code></pre>
  <p>But it raises this error:</p>
  <pre class="lang-py prettyprint-override"><code>Go to the following link in your browser:
  
      https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&amp;redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&amp;scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&amp;code_challenge=WkM1RS8Flu1_txc3jn4V_FfutgZuRaHSzYbDvs134PM&amp;code_challenge_method=S256&amp;access_type=offline&amp;response_type=code&amp;prompt=select_account
  
  
  Enter verification code: ··········
  ---------------------------------------------------------------------------
  AuthorizationError                        Traceback (most recent call last)
  &lt;ipython-input-2-bb96e063f8ef&gt; in &lt;module&gt;()
        6 
        7 #Authenticating and creating the PyDrive client
  ----&gt; 8 auth.authenticate_user()
        9 gauth = GoogleAuth()
       10 gauth.credentials = GoogleCredentials.get_application_default()
  
  1 frames
  /usr/local/lib/python3.6/dist-packages/google/colab/auth.py in authenticate_user(clear_output)
      147     context_manager = _output.temporary if clear_output else _noop
      148     with context_manager():
  --&gt; 149       _gcloud_login()
      150     _install_adc()
      151     colab_tpu_addr = _os.environ.get('COLAB_TPU_ADDR', '')
  
  /usr/local/lib/python3.6/dist-packages/google/colab/auth.py in _gcloud_login()
       97     _os.remove(name)
       98   if gcloud_process.returncode:
  ---&gt; 99     raise _errors.AuthorizationError('Error fetching credentials')
      100 
      101 
  
  AuthorizationError: Error fetching credentials
  </code></pre>
  <p>Does anyone know what is wrong? I have been working for a long time importing files located on my Google drive and never had these problems.</p>