I'm designing a desktop app in Windows using Python that logs into a google
sheets to get some client information to do some tasks afterward.
Essentially it is a time dependent app that does a particular set of
actions while local time is less than 7:30 PM. Here's the layout of main
function 'full()':
def full():
inst = 1
while datetime.datetime.now().time() <= datetime.time(19, 30):
if inst == 1:
global customers
customers = customers()
else:
new_c = customers()
c = updat(customers, new_c)
customers = new_c[c]
time.sleep(10*60)
inst += 1
When it hits the second iteration of the process (inst = 2), the consolse
thows out the error of "'DataFrame' object is not callable". This is very
odd because the first time it rolls through it works fine.
The two functions 'customers()' and 'update()' are:
def customers():
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_id.json',
scope)
gs = gspread.authorize(creds)
sheet = gs.open('RC').sheet1
c_list = sheet.get_all_records()
return pd.DataFrame(c_list)
def updat(a, b):
c = []
for i in range(len(b)):
for j in range(len(a)):
if b.Nombre.iloc[i] == a.Nombre.iloc[j]:
c.append(False)
break # fix #1
else: # fix #2
c.append(True)
return c
It might be worth knowing that the layout of the function is design to read
the google sheets to check for client information, and after the first time
just read the newer entries (the olds will be ignored).
Thanks,
--
You received this message because you are subscribed to the Google Groups
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.