脚本仅在重新启动脚本后才能工作吗?

时间:2019-02-09 07:54:53

标签: python python-3.x google-sheets-api

with open("a.txt", "r") as a:
    try:     
        b = a.readlines()[2]
        wks = gc.open('Test').sheet1
        if b not in open('c.txt').read():
            check = "True"
            wks.append_row(['test', 'test'])
            print("Spreadsheet appended.")
            with open("c.txt", "a") as c:
                c.write(blah_blah+"\n")
        else:
            check = "False"
            do_x()
    except:
        pass  

当前,仅在重新启动脚本后才添加电子表格。我想将脚本自动添加到电子表格中,但是我不确定错误在哪里!

编辑:删除try / except后12小时左右返回此错误。

gspread.exceptions.APIError: {
 "error": {
 "errors": [
  {
   "domain": "global",
   "reason": "authError",
   "message": "Invalid Credentials",
   "locationType": "header",
   "location": "Authorization"
  }
 ],
 "code": 401,
 "message": "Invalid Credentials"
 }
}

0 个答案:

没有答案