0
import sys
import os

from pydrive2.drive import GoogleDrive

from authentication import AUTH

drive = GoogleDrive(AUTH)

content = drive.ListFile({'q': 'title = "Python"'}).GetList()
file = drive.CreateFile(
    {
        'title': os.path.basename(sys.argv[0]),
        'parents': [{
            'id': '0ADVPbx_UmzeDUk9PVA',
            'kind': 'drive#parentReference',
        }]
    }
)
file.GetContentFile(filename = os.path.basename(sys.argv[0]), mimetype = 'text/x-python')
file.Upload()

I've been playing with this for awhile with no luck. I keep getting the same error and I have no idea what it is I'm doing wrong. I'm trying to follow this to upload files.

Here is the error I'm geting:

Traceback (most recent call last):
  File "C:\Users\phpjunkie\Python\Google Drive\test1.py", line 20, in <module>
    file.GetContentFile(filename = os.path.basename(sys.argv[0]), mimetype = 'text/x-python')
  File "C:\Users\phpjunkie\Python\Google Drive\venv\Lib\site-packages\pydrive2\auth.py", line 84, in _decorated
    return decoratee(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\phpjunkie\Python\Google Drive\venv\Lib\site-packages\pydrive2\files.py", line 324, in GetContentFile
    raise FileNotUploadedError()
pydrive2.files.FileNotUploadedError
phpjunkie
  • 3
  • 3
  • Right off the bat, since the error comes from decoratee, it suggests that the auth process is having some issue? – blessthefry Jul 03 '23 at 06:11

0 Answers0