RuntimeError:无法初始化SecretService:未设置环境变量DBUS_SESSION_BUS_ADDRESS

时间:2018-09-10 20:11:09

标签: python rhel python-keyring

试图发布密钥环:

RuntimeError:无法初始化SecretService:未设置环境变量DBUS_SESSION_BUS_ADDRESS

SecretService已取消安装。 操作系统是RHEL

运行:  python -c“将keyring.backends.SecretService导入为SS; SS.Keyring.priority”

出现以下错误: 追溯(最近一次通话):   dbus_init中的文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/secretstorage/init.py”,第41行     返回connect_and_authenticate()   文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/jeepney/integrate/blocking.py”,第70行,位于connect_and_authenticate     bus_addr = get_bus(公共汽车)   在get_bus的第53行,文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/jeepney/bus.py”     返回find_session_bus()   在find_session_bus的第42行,文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/jeepney/bus.py”     addr = os.environ ['DBUS_SESSION_BUS_ADDRESS']    getitem 中的文件“ /home/webpage/.pyenv/versions/3.6.5/lib/python3.6/os.py”,行669     从None提高KeyError(key) KeyError:“ DBUS_SESSION_BUS_ADDRESS”

上述异常是以下异常的直接原因:

回溯(最近通话最近):   优先处理文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/keyring/backends/SecretService.py”,第37行     总线= secretstorage.dbus_init()   dbus_init中的文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/secretstorage/init.py”,第45行     从ex引发SecretServiceNotAvailableException(reason) secretstorage.exceptions.SecretServiceNotAvailableException:未设置环境变量DBUS_SESSION_BUS_ADDRESS

在处理上述异常期间,发生了另一个异常:

回溯(最近通话最近):   文件“”,第1行,位于   获取中的文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/keyring/util/properties.py”,第26行     返回self.fget。获取(无,所有者)()   优先使用文件“ /home/webpage/.pyenv/versions/WEBPAGE/lib/python3.6/site-packages/keyring/backends/SecretService.py”,第41行     “无法初始化SecretService:%s”%e) RuntimeError:无法初始化SecretService:环境变量DBUS_SESSION_BUS_ADDRESS未设置

感谢您的帮助!

2 个答案:

答案 0 :(得分:0)

缺少依赖项:dbus-python

答案 1 :(得分:0)

尝试

export $(dbus-launch)