TypeError: GoogleAuth.LocalWebserverAuth() missing 1 required positional argument: 'self'

Viewed 31

I am trying to authenticate google api and after following all the necessary steps like making credentials and installing pydrive, I am faced with this error when running the main.py module TypeError: GoogleAuth.LocalWebserverAuth() missing 1 required positional argument: 'self' Do you guys have any idea how to fix it. thank you in advance :)

main.py code

from pydrive.drive import GoogleDrive

gauth = GoogleAuth
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
1 Answers

The Python "TypeError: missing 1 required positional argument: 'self'" occurs if you call a method on the class instead of on an instance of the class.

You are missing from pydrive.auth import GoogleAuth

pydrive

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

gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
Related