0

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

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

认证成功。将凭据存储到 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'

4

1 回答 1

1

这是一个已知错误,已在主干中修复。所以,要么从 staging 分支安装 pygsheets

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

或作为解决方法禁用缓存

gc = pygsheets.authorize(outh_file='client_secret.json', no_cache=True)
于 2017-12-06T16:39:23.833 回答