首页 > 解决方案 > oauth2client 作为服务运行时抛出 AttributeError

问题描述

我正在尝试使用在树莓派上运行的简单 python 脚本访问谷歌日历 API。

此脚本来自此处的示例:

from oauth2client import file, client, tools
store = file.Storage('home/pi/brief/token.json')
creds = store.get()

..从命令行运行时工作正常,但是当作为服务(systemctl)运行时,它退出,说:

python[27500]:     store = file.Storage('home/pi/brief/token.json')
python[27500]: AttributeError: 'file' object has no attribute 'Storage'

我必须在这里遗漏一些基本的东西。提前谢谢了!

标签: pythonoauth2client

解决方案


我重新安装了 oauth2client 并重新配置了服务,现在它可以工作了。打我什么是错的。谢谢大家的努力。


推荐阅读