Python Google Drive中的PyDrive创建文件夹-错误为AttributeError:';谷歌硬盘';对象没有属性';文件夹

Python Google Drive中的PyDrive创建文件夹-错误为AttributeError:';谷歌硬盘';对象没有属性';文件夹,python,google-drive-api,pydrive,Python,Google Drive Api,Pydrive,试图根据日期使用PyDrive在现有文件夹中创建文件夹,但我不断收到错误,因为“GoogleDrive”对象没有属性“files” 但我收到的错误是“GoogleDrive”对象没有属性“files” 我做错什么了吗 from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive gauth = GoogleAuth() gauth.LoadCredentialsFile("token.txt&qu

试图根据日期使用PyDrive在现有文件夹中创建文件夹,但我不断收到错误,因为“GoogleDrive”对象没有属性“files”

但我收到的错误是“GoogleDrive”对象没有属性“files”

我做错什么了吗

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive

gauth = GoogleAuth()
gauth.LoadCredentialsFile("token.txt")

if gauth.credentials is None:
    gauth.GetFlow()
    gauth.flow.params.update({'access_type': 'offline'})
    gauth.flow.params.update({'approval_prompt': 'force'})
    gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
    gauth.Refresh()
else:
    gauth.Authorize()
gauth.SaveCredentialsFile("token.txt")  
drive = GoogleDrive(gauth)

file_metadata = {'name': 'Test','mimeType': 'application/vnd.google-apps.folder'}
file = drive.files().create(body=file_metadata).execute()
print('Folder ID: %s' % file.get('id'))