python - Raspberry Pi:keyring.errors.InitError:无法创建集合:提示已关闭
问题描述
尝试在树莓派零上使用 python-keyring 保存凭据(Raspbian GNU/Linux 10)
import keyring
keyring.set_password("service", "username", "pw")
导致错误
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 43, in __init__
signature='ss')
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 34, in function_out
raise ItemNotFoundException('Item does not exist!')
secretstorage.exceptions.ItemNotFoundException: Item does not exist!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 52, in get_preferred_collection
collection = secretstorage.get_default_collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 158, in get_default_collection
'default', session)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 139, in create_collection
raise ItemNotFoundException('Prompt dismissed.')
secretstorage.exceptions.ItemNotFoundException: Prompt dismissed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell>", line 1, in <module>
File "/usr/lib/python3/dist-packages/keyring/core.py", line 63, in set_password
_keyring_backend.set_password(service_name, username, password)
File "/usr/lib/python3/dist-packages/keyring/backends/chainer.py", line 53, in set_password
return keyring.set_password(service, username, password)
File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 77, in set_password
collection = self.get_preferred_collection()
File "/usr/lib/python3/dist-packages/keyring/backends/SecretService.py", line 54, in get_preferred_collection
raise InitError("Failed to create the collection: %s." % e)
keyring.errors.InitError: Failed to create the collection: Prompt dismissed..
在 Linux Mint 20.1 Ulyssa 机器上运行相同的命令没有问题。
解决方案
推荐阅读
- python - C++ 代码和 Python 代码之间的通信
- server - 在网站构建器中处理自定义域?
- php - 使用php阻止url指定的文件夹或路径
- ffmpeg - 使用 pkg-config 未找到编译 FFMPEG x265
- spring - 引起:java.lang.ClassNotFoundException: org.springframework.messaging.converter.MessageConverter 在微服务
- swift - 为什么没有迅速收到委托事件?
- mysql - 十月 CMS - 第 1 行的“内容”列的数据太长
- xml - ID / IDREF 的 Docbook / XML 限制
- javascript - 查询结果在JQuery函数中的错误响应
- jquery - 修复相对于父级的内容