pygsheets 身份验证成功但令牌文件未正确读回

pygsheets authentication successful but token file not read back in correctly

我启用了 google api 并在 google 控制台上创建了一个 oauth 2.0 id,我在网络浏览器中收到授权访问的提示,但随后我收到 FileNotFoundError 错误在 Jupyter 实验室中

gc = pygsheets.authorize(outh_file='client_secret.json')

Authentication successful. Storing credentials to C:\Users\me\Documents\Folder\PythonProject\sheets.googleapis.com-python.json

令牌文件已成功创建,但 NotFoundError 正在查找临时文件夹而不是它保存文件的文件夹

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\me\AppData\Local\Temp\02b35e51-6576-4739-9f1c-135348c707f0\www.googleapis.com,drive,v3,files,corpora=user&pageSize=500&fields=files%28id%2C+name%29&q=mimeType%3D%27application%2Fvnd.google-apps.spreadsheet%27&supportsTeamDrives=false&includeTeamDriveItems=fal,6fa737f4e6c871f0b9ea9ea38467b8b6'

这是一个已知错误,已在主干中修复。因此,要么从暂存分支安装 pygsheets

pip install https://github.com/nithinmurali/pygsheets/archive/staging.zip

或作为解决方法禁用缓存

gc = pygsheets.authorize(outh_file='client_secret.json', no_cache=True)