Okay so I made script that requires some inputs, puts them together in a string then downloads user_info.txt file from my google drive and then it appends that string to that file and uploads it back to the google drive. It works on my machine like it is supposed to but when I send exe file to my friend together with client_secrets.json he tries it and it says authentication is successful but the string is not appended to txt file when i check it on my google drive. So my guess is that it fails to download the user_info.txt file for some reason on his pc because I didnt put function to delete user_info.txt after downloading in my code and on his pc there is no user_info.txt file after running exe file of this script. Please help!
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from os import system, name
from time import sleep
class Register(object):
def __init__(self):
system('cls')
self.fname = input("First name: ")
system('cls')
self.lname = input("Last name: ")
system('cls')
self.passw = input("Password: ")
system('cls')
def Upload(self):
fileList=drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList()
for files in fileList:
if files['title'] == 'user_info.txt':
files.GetContentFile("user_info.txt")
update = files.GetContentString() + self.fname + " " + self.lname + " " + self.passw + "\n"
files.SetContentString(update)
files.Upload()
break
gauth=GoogleAuth()
drive=GoogleDrive(gauth)
system('cls')
while True:
Registration = Register()
if Registration.fname.isalpha() == False:
print("Invalid first name!")
sleep(1)
continue
elif Registration.lname.isalpha() == False:
print("Invalid last name!")
sleep(1)
continue
else:
Registration.Upload()
system('cls')
print(f"Welcome {Registration.fname} {Registration.lname}.")
next = input("")
system('cls')
break
****UPDATE**** I realized that script works only for my email where i enabled Drive API and used it in code, but for other emails (users) it seems to refuse to execute the part of the code where it is supposed to download txt file, edit it and upload. Like it refuses connection if it is not my email but it says in browser "The authentication flow has completed"... How do i enable it to work for other emails (users)