尝试在树莓派零上使用 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 机器上运行相同的命令没有问题。