Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python密钥环,无法设置密码_Python_Python Keyring - Fatal编程技术网

python密钥环,无法设置密码

python密钥环,无法设置密码,python,python-keyring,Python,Python Keyring,安装后,我对python密钥环有一个问题。 以下是我的步骤: $ python >>> import keyring >>> keyring.set_password('something','otherSomething','lotOfMoreSomethings') 然后抛出这个: Traceback (most recent call last): File "<stdin>", line 1, in <module> File

安装后,我对python密钥环有一个问题。 以下是我的步骤:

$ python
>>> import keyring
>>> keyring.set_password('something','otherSomething','lotOfMoreSomethings')
然后抛出这个:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/keyring/core.py", line 42, in set_password
   _keyring_backend.set_password(service_name, username, password)
File "/usr/local/lib/python2.6/dist-packages/keyring/backend.py", line 222, in set_password
   _, session = service_iface.OpenSession("plain", "")
File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 68, in __call__
   return self._proxy_method(*args, **keywords)
File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 140, in __call__
   **keywords)
File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 630, in call_blocking
   message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
   Method "OpenSession" with signature "ss" on interface "org.freedesktop.Secret.Service" 
   doesn't exist
我做错什么了吗??有什么解决办法吗

编辑:

我还从repos安装了pythonkeyring和pythonkeyringgnome,并像导入一样导入

>>> import gnome_keyring

如果使用gnomekeyring python包,您可以使用item_create_sync方法为给定密钥创建新密码条目或替换现有密码

#!/usr/bin/env python
import gnomekeyring

gnomekeyring.item_create_sync ("keyring-name", gnomekeyring.ITEM_GENERIC_SECRET, "key-display-name", {}, "password", True)
其中项目\u创建\u同步方法签名为

item_create_sync (string? keyring, ItemType type, string display_name, AttributeList attributes, string secret, bool update_if_exists)

我也遇到过类似的问题,但我的DBus异常出现在kwalletd上(特别是/modules/kwalletd),尽管我使用了Gnome

我的工作是创建一个本地“keyringrc.cfg”文件,如下所示:

[backend]
default-keyring=keyring.backends.Gnome.Keyring

有关确定系统配置文件路径的信息,请参阅。

这不是
keyring
问题,而是本地Gnome设置的问题。它似乎没有运行Gnome密钥环服务。这似乎与:@Martijn nope。。服务正在运行。已经检查过了只是出于好奇,你在运行什么版本的gnome钥匙圈?(运行
$gnome钥匙圈版本
)hi fmoo。我有gnome钥匙圈v2.30.3-5,我在独奏1.2:)
[backend]
default-keyring=keyring.backends.Gnome.Keyring