0

I am using python version 3 with PyDrive to connect Google spreadsheet. I succeeded to open browser and do authentication. However, after that I got an error and program does not continue.

this is an error message

Authentication successful.
Traceback (most recent call last):
File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/pydrive/files.py", line 369, in _FilesInsert
http=self.http)
File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/googleapiclient/http.py", line 812, in execute
_, body = self.next_chunk(http=http, num_retries=num_retries)
File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/googleapiclient/http.py", line 916, in next_chunk
raise ResumableUploadError(resp, content)
googleapiclient.errors.ResumableUploadError: <HttpError 403 "Project 895099846013 is not found and cannot be used for API calls. If it is recently created, enable Drive API by visiting then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.">
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "drive_control.py", line 10, in <module>
   file.Upload()
 File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/pydrive/files.py", line 285, in Upload
self._FilesInsert(param=param)
 File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/pydrive/auth.py", line 75, in _decorated
return decoratee(self, *args, **kwargs)
 File "/home/PycharmProjects/misc/.venv/lib/python3.5/site-packages/pydrive/files.py", line 371, in _FilesInsert
raise ApiRequestError(error)
pydrive.files.ApiRequestError: <HttpError 403 "Project 895099846013 is not found and cannot be used for API calls. If it is recently created, enable Drive API by visiting url If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.">

this is my code from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive

gauth = GoogleAuth()
gauth.LocalWebserverAuth()

drive = GoogleDrive(gauth)
file = drive.CreateFile({'title': 'Hello.txt'})
file.SetContentString('Hello World!')
file.Upload()
ruth
  • 109
  • 2
  • 11

1 Answers1

1

this error have clear description in traceback:

403 "Project 895099846013 is not found and cannot be used for API calls. If it is recently created, enable Drive API by visiting url

In your account, you must have the enabled status of the Google Drive API.

You can see it in the Console Developer toolbar

If you do not see it, follow the instructions

erroia
  • 378
  • 3
  • 10