def main(name): i = 1 if not os.path.exists('log/sent_files_log.txt'): os.popen('touch log/sent_files_log.txt') f = open('log/sent_files_log.txt', 'a') Person.connect_db() ps = Person.find_all() print ps for p in ps: try: # With retrieved access strings, accesses dropbox account print (p.access_token, p.access_secret, p.kindle_email) if not p.can_send_files_to_kindle(): continue try: sess = session.DropboxSession(APP_KEY, APP_SECRET, ACCESS_TYPE) sess.set_token(p.access_token, p.access_secret) account = client.DropboxClient(sess) files_sent = send_files_to_kindle(account, p.kindle_email) print "files_sent:", files_sent f.write("Call #" + i.__str__() + ", ") f.write(p.kindle_email + "\n") f.write("files_sent: " + files_sent.__str__() + "\n") i += 1 except: print "something went wrong" except: #sendemail.mail_without_attach("*****@*****.**", "KindleFolder Error: authenticate_paths for loop error","There was an issue with one of the for loop things in authenticate_paths.py.<br /><br />") #sendemail.mail_without_attach("*****@*****.**", "KindleFolder Error: authenticate_paths for loop error","There was an issue with one of the for loop things in authenticate_paths.py.<br /><br />") pass f.write("\n") f.close() Person.close_db()