3

I'm having a problem with python keyring after the installation. here are my steps:

$ python
>>> import keyring
>>> keyring.set_password('something','otherSomething','lotOfMoreSomethings')

and then throws this:

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

i have installed keyring from here using

easy_install keyring

Do i do anything wrong?? There are any solution??

Edit:

Also i've installed python-keyring and python-keyring-gnome from repos and just import like

>>> import gnome_keyring

and works.

Matias
  • 265
  • 3
  • 11
  • This is not a `keyring` problem, but a problem with your local Gnome setup. It doesn't appear to have a Gnome Keyring service running. – Martijn Pieters Oct 20 '12 at 22:16
  • 1
    This appears to be related: https://answers.launchpad.net/polly/+question/195167 – Martijn Pieters Oct 20 '12 at 22:18
  • @Martijn nope.. the service is running. Already checked – Matias Oct 20 '12 at 22:22
  • Just out of curiosity, what version of gnome-keyring are you running? (run `$ gnome-keyring version`) – fmoo Nov 11 '12 at 07:09
  • hi fmoo. I've gnome-keyring v2.30.3-5, i'm on SolusOS 1.2 :) – Matias Nov 13 '12 at 02:04
  • Possible duplicate of [Is there a way to access the keyring in Windows without giving a master password?](https://stackoverflow.com/questions/16799049/is-there-a-way-to-access-the-keyring-in-windows-without-giving-a-master-password) – stovfl Jun 15 '17 at 17:20

2 Answers2

0

If using gnomekeyring python package, you can use item_create_sync method to create a new password entry or replace existing password for a given key

#!/usr/bin/env python
import gnomekeyring

gnomekeyring.item_create_sync ("keyring-name", gnomekeyring.ITEM_GENERIC_SECRET, "key-display-name", {}, "password", True)

where item_create_sync method signature is

item_create_sync (string? keyring, ItemType type, string display_name, AttributeList attributes, string secret, bool update_if_exists)
Jonathan L
  • 9,552
  • 4
  • 49
  • 38
0

I've been having a similar problem but my DBus Exception was on kwalletd (specifically /modules/kwalletd) even though I use Gnome.

My work around was to create a local "keyringrc.cfg" file like so:

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

See the Python keyring Package for determining where the Config file path is for your system.

94gC
  • 1
  • 1