New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
23.3.0: pytest is failing #550
Comments
I see at least two classes of error. The first is a single failure in test_packaging:
In this case, the failure is likely due to how the tests are being run... and maybe a bug in
I'd expect to see something like:
|
I see a couple of errors about
That seems to be a bug in the tests and a reminder that these kwallet tests aren't run in CI (and apparently aren't run anywhere else either). I've committed what I hope is a fix in c63ab7d. |
The third class of issues appears to be that the DBusKeyring is unable to connect to the kwallet service:
I don't see that error reported anywhere. @mitya57 do you have any recommendations on how this user can avoid these errors when running the tests (either by improving the viability detection in the backend or by properly configuring the environment to work with the backend)? |
I don't understand why that could happen. We have the following code to check that the service is activatable: keyring/keyring/backends/kwallet.py Lines 49 to 55 in 0f0faf1
If that check passes, then the service should be activatable, and @kloczek Do you have kwallet installed on the system where tests were run? Can you run this code and check what it prints? >>> from keyring.backends import kwallet
>>> print(kwallet.DBusKeyring.viable) |
$ pip show importlib_metadata
Name: importlib-metadata
Version: 4.8.1
Summary: Read metadata from Python packages
Home-page: https://github.com/python/importlib_metadata
Author: Jason R. Coombs
Author-email: jaraco@jaraco.com
License: UNKNOWN
Location: /usr/lib/python3.8/site-packages
Requires: zipp
Required-by: keyring In rpm spec file I have as well: BuildRequires: python3dist(importlib-metadata) So it would be no tpossible to build |
During that test I had installed but I was not aware that it is here some test dependency [tkloczko@ss-desktop SPECS]$ rpm -q kf5-kwallet
kf5-kwallet-5.88.0-2.g2v.x86_64 |
Just tested keyring with c63ab7d. [tkloczko@ss-desktop SPECS]$ rpmbuild -ba --with failing_tests python-keyring.spec
warning: Downloading https://github.com/jaraco/keyring//archive/v23.3.0.tar.gz#/python-keyring-23.3.0.tar.gz to /home/tkloczko/rpmbuild/SOURCES/python-keyring-23.3.0.tar.gz
warning: Downloading https://github.com/jaraco/keyring//commit/c63ab7dc.patch#/python-keyring-Use-simple-asserts-as-assertEqual-only-works-under.patch to /home/tkloczko/rpmbuild/SOURCES/python-keyring-Use-simple-asserts-as-assertEqual-only-works-under.patch
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.uqCCBH
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ cd /home/tkloczko/rpmbuild/BUILD
+ rm -rf keyring-23.3.0
+ /usr/bin/gzip -dc /home/tkloczko/rpmbuild/SOURCES/python-keyring-23.3.0.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd keyring-23.3.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-keyring-man3_level.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-keyring-shebangs.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-keyring-Use-simple-asserts-as-assertEqual-only-works-under.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ RPM_EC=0
[..]
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-keyring-23.3.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-keyring-23.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
rootdir: /home/tkloczko/rpmbuild/BUILD/keyring-23.3.0, configfile: pytest.ini
plugins: shutil-1.7.0, virtualenv-1.7.0, mock-3.6.1, cov-2.12.1, anyio-3.3.4, forked-1.3.0, xdist-2.3.0, flaky-3.7.0, tornasync-0.6.0.post2, console-scripts-1.2.0, trio-0.7.0, timeout-2.0.1, asyncio-0.16.0, hypothesis-6.27.0, freezegun-0.4.2, flake8-1.0.7, pyfakefs-4.5.3
collected 89 items
keyring/core.py . [ 1%]
keyring/backends/chainer.py . [ 2%]
keyring/backends/fail.py . [ 3%]
keyring/backends/null.py . [ 4%]
keyring/util/__init__.py . [ 5%]
keyring/util/properties.py .. [ 7%]
tests/test_core.py . [ 8%]
tests/test_errors.py . [ 10%]
tests/test_integration.py ... [ 13%]
tests/test_multiprocess.py xx [ 15%]
tests/test_packaging.py F. [ 17%]
tests/backends/test_SecretService.py ............ [ 31%]
tests/backends/test_Windows.py ssssssssssssss [ 47%]
tests/backends/test_chainer.py .. [ 49%]
tests/backends/test_kwallet.py FFFFF.FFFF.sssssssssss [ 74%]
tests/backends/test_libsecret.py ............ [ 87%]
tests/backends/test_macOS.py sssssssssss [100%]
================================================================================= FAILURES =================================================================================
_____________________________________________________________________________ test_entry_point _____________________________________________________________________________
def test_entry_point():
"""
Keyring provides exactly one 'keyring' console script
that's a callable.
"""
matches = metadata.entry_points(group='console_scripts', name='keyring')
> (script,) = matches
E ValueError: too many values to unpack (expected 1)
tests/test_packaging.py:12: ValueError
__________________________________________________________________ TestDBusKWallet.test_password_set_get ___________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb981ec40>, service = '16zOrGWDcjKSSTGGeCuy'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb981e610>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb981e1f0>
def test_password_set_get(self):
password = random_string(20)
username = random_string(20)
service = random_string(20)
> self.check_set_get(service, username, password)
keyring/testing/backend.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/backends/test_kwallet.py:43: in check_set_get
assert keyring.get_password(service, username) is None
keyring/backends/kwallet.py:110: in get_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb981ec40>, service = '16zOrGWDcjKSSTGGeCuy'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
___________________________________________________________________ TestDBusKWallet.test_difficult_chars ___________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb9765820>, service = '.*}\\\x0b;#\r^;;&>*?%\x0c/{<'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb9765100>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb9765610>
def test_difficult_chars(self):
password = random_string(20, self.DIFFICULT_CHARS)
username = random_string(20, self.DIFFICULT_CHARS)
service = random_string(20, self.DIFFICULT_CHARS)
> self.check_set_get(service, username, password)
keyring/testing/backend.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/backends/test_kwallet.py:43: in check_set_get
assert keyring.get_password(service, username) is None
keyring/backends/kwallet.py:110: in get_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb9765820>, service = '.*}\\\x0b;#\r^;;&>*?%\x0c/{<'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
___________________________________________________________________ TestDBusKWallet.test_delete_present ____________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb96888e0>, service = "\t>\\}&:(_)\x0c%*`^=/[:!'"
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb9688fa0>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb9688e80>
def test_delete_present(self):
password = random_string(20, self.DIFFICULT_CHARS)
username = random_string(20, self.DIFFICULT_CHARS)
service = random_string(20, self.DIFFICULT_CHARS)
> self.keyring.set_password(service, username, password)
keyring/testing/backend.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/backends/kwallet.py:141: in set_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb96888e0>, service = "\t>\\}&:(_)\x0c%*`^=/[:!'"
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
_________________________________________________________________ TestDBusKWallet.test_delete_not_present __________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb9588a90>, service = '*=?(.?{&)|^}.([\\*>>\x0c'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb9588be0>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb95881c0>
def test_delete_not_present(self):
username = random_string(20, self.DIFFICULT_CHARS)
service = random_string(20, self.DIFFICULT_CHARS)
with pytest.raises(errors.PasswordDeleteError):
> self.keyring.delete_password(service, username)
keyring/testing/backend.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/backends/kwallet.py:148: in delete_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb9588a90>, service = '*=?(.?{&)|^}.([\\*>>\x0c'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
_________________________________________________________________ TestDBusKWallet.test_delete_one_in_group _________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb96531f0>, service = "}]'\r#:\r[%,\t^~[^=;&+`"
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb96530a0>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb9653f70>
def test_delete_one_in_group(self):
username1 = random_string(20, self.DIFFICULT_CHARS)
username2 = random_string(20, self.DIFFICULT_CHARS)
password = random_string(20, self.DIFFICULT_CHARS)
service = random_string(20, self.DIFFICULT_CHARS)
> self.keyring.set_password(service, username1, password)
keyring/testing/backend.py:99:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/backends/kwallet.py:141: in set_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb96531f0>, service = "}]'\r#:\r[%,\t^~[^=;&+`"
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
____________________________________________________________________ TestDBusKWallet.test_unicode_chars ____________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb95a9a30>, service = 'зааךעетθегоβёаμтελпп'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb95a9880>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb95a96d0>
def test_unicode_chars(self):
password = random_string(20, UNICODE_CHARS)
username = random_string(20, UNICODE_CHARS)
service = random_string(20, UNICODE_CHARS)
> self.check_set_get(service, username, password)
keyring/testing/backend.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/backends/test_kwallet.py:43: in check_set_get
assert keyring.get_password(service, username) is None
keyring/backends/kwallet.py:110: in get_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb95a9a30>, service = 'зааךעетθегоβёаμтελпп'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
_______________________________________________________________ TestDBusKWallet.test_unicode_and_ascii_chars _______________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb96e8e50>, service = 'hע\tа|=~а~\tъh\t=FJ%x6ы'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb96e8d90>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb96e8be0>
def test_unicode_and_ascii_chars(self):
source = (
random_string(10, UNICODE_CHARS)
+ random_string(10)
+ random_string(10, self.DIFFICULT_CHARS)
)
password = random_string(20, source)
username = random_string(20, source)
service = random_string(20, source)
> self.check_set_get(service, username, password)
keyring/testing/backend.py:122:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/backends/test_kwallet.py:43: in check_set_get
assert keyring.get_password(service, username) is None
keyring/backends/kwallet.py:110: in get_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb96e8e50>, service = 'hע\tа|=~а~\tъh\t=FJ%x6ы'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
___________________________________________________________________ TestDBusKWallet.test_different_user ____________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb970d760>, service = 'service1'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb970d6d0>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb970d4c0>
def test_different_user(self):
"""
Issue #47 reports that WinVault isn't storing passwords for
multiple users. This test exercises that test for each of the
backends.
"""
keyring = self.keyring
> self.set_password('service1', 'user1', 'password1')
keyring/testing/backend.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/backends/test_kwallet.py:37: in set_password
super().set_password(service, username, password)
keyring/testing/backend.py:51: in set_password
self.keyring.set_password(service, username, password)
keyring/backends/kwallet.py:141: in set_password
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb970d760>, service = 'service1'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
_____________________________________________________________________ TestDBusKWallet.test_credential ______________________________________________________________________
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
> return self.get_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:177:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def get_name_owner(self, bus_name):
"""Return the unique connection name of the primary owner of the
given name.
:Raises `DBusException`: if the `bus_name` has no owner
:Since: 0.81.0
"""
keywords = {}
if is_py2:
keywords['utf8_strings'] = True
validate_bus_name(bus_name, allow_unique=False)
> return self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE, 'GetNameOwner',
's', (bus_name,), **keywords)
/usr/lib64/python3.8/site-packages/dbus/bus.py:361:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'GetNameOwner', signature = 's', args = ('org.kde.kwalletd5',), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: GetNameOwner dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: The name does not have an owner
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb958a910>, service = 'service'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
> remote_obj = bus.get_object(self.bus_name, self.object_path)
keyring/backends/kwallet.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, named_service = None
def get_object(self, bus_name, object_path, introspect=True,
follow_name_owner_changes=False, **kwargs):
"""Return a local proxy for the given remote object.
Method calls on the proxy are translated into method calls on the
remote object.
:Parameters:
`bus_name` : str
A bus name (either the unique name or a well-known name)
of the application owning the object. The keyword argument
named_service is a deprecated alias for this.
`object_path` : str
The object path of the desired object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If the object path is a well-known name and this parameter
is false (default), resolve the well-known name to the unique
name of its current owner and bind to that instead; if the
ownership of the well-known name changes in future,
keep communicating with the original owner.
This is necessary if the D-Bus API used is stateful.
If the object path is a well-known name and this parameter
is true, whenever the well-known name changes ownership in
future, bind to the new owner, if any.
If the given object path is a unique name, this parameter
has no effect.
:Returns: a `dbus.proxies.ProxyObject`
:Raises `DBusException`: if resolving the well-known name to a
unique name fails
"""
if follow_name_owner_changes:
self._require_main_loop() # we don't get the signals otherwise
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both '
'be specified')
from warnings import warn
warn('Passing the named_service parameter to get_object by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
bus_name = named_service
if kwargs:
raise TypeError('get_object does not take these keyword '
'arguments: %s' % ', '.join(kwargs.keys()))
> return self.ProxyObjectClass(self, bus_name, object_path,
introspect=introspect,
follow_name_owner_changes=follow_name_owner_changes)
/usr/lib64/python3.8/site-packages/dbus/bus.py:241:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0x7f4eba054950> org.kde.kwalletd5 /modules/kwalletd5 at 0x7f4eb958a850>
conn = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', object_path = '/modules/kwalletd5', introspect = True
follow_name_owner_changes = False, kwargs = {}, bus = None, named_service = None
def __init__(self, conn=None, bus_name=None, object_path=None,
introspect=True, follow_name_owner_changes=False, **kwargs):
"""Initialize the proxy object.
:Parameters:
`conn` : `dbus.connection.Connection`
The bus or connection on which to find this object.
The keyword argument `bus` is a deprecated alias for this.
`bus_name` : str
A bus name for the application owning the object, to be used
as the destination for method calls and the sender for
signal matches. The keyword argument ``named_service`` is a
deprecated alias for this.
`object_path` : str
The object path at which the application exports the object
`introspect` : bool
If true (default), attempt to introspect the remote
object to find out supported methods and their signatures
`follow_name_owner_changes` : bool
If true (default is false) and the `bus_name` is a
well-known name, follow ownership changes for that name
"""
bus = kwargs.pop('bus', None)
if bus is not None:
if conn is not None:
raise TypeError('conn and bus cannot both be specified')
conn = bus
from warnings import warn
warn('Passing the bus parameter to ProxyObject by name is '
'deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
named_service = kwargs.pop('named_service', None)
if named_service is not None:
if bus_name is not None:
raise TypeError('bus_name and named_service cannot both be '
'specified')
bus_name = named_service
from warnings import warn
warn('Passing the named_service parameter to ProxyObject by name '
'is deprecated: please use positional parameters',
DeprecationWarning, stacklevel=2)
if kwargs:
raise TypeError('ProxyObject.__init__ does not take these '
'keyword arguments: %s'
% ', '.join(kwargs.keys()))
if follow_name_owner_changes:
# we don't get the signals unless the Bus has a main loop
# XXX: using Bus internals
conn._require_main_loop()
self._bus = conn
if bus_name is not None:
_dbus_bindings.validate_bus_name(bus_name)
# the attribute is still called _named_service for the moment,
# for the benefit of telepathy-python
self._named_service = self._requested_bus_name = bus_name
_dbus_bindings.validate_object_path(object_path)
self.__dbus_object_path__ = object_path
if not follow_name_owner_changes:
> self._named_service = conn.activate_name_owner(bus_name)
/usr/lib64/python3.8/site-packages/dbus/proxies.py:250:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5'
def activate_name_owner(self, bus_name):
if (bus_name is not None and bus_name[:1] != ':'
and bus_name != BUS_DAEMON_NAME):
try:
return self.get_name_owner(bus_name)
except DBusException as e:
if e.get_dbus_name() != _NAME_HAS_NO_OWNER:
raise
# else it doesn't exist: try to start it
> self.start_service_by_name(bus_name)
/usr/lib64/python3.8/site-packages/dbus/bus.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.kde.kwalletd5', flags = 0
def start_service_by_name(self, bus_name, flags=0):
"""Start a service which will implement the given bus name on this Bus.
:Parameters:
`bus_name` : str
The well-known bus name to be activated.
`flags` : dbus.UInt32
Flags to pass to StartServiceByName (currently none are
defined)
:Returns: A tuple of 2 elements. The first is always True, the
second is either START_REPLY_SUCCESS or
START_REPLY_ALREADY_RUNNING.
:Raises `DBusException`: if the service could not be started.
:Since: 0.80.0
"""
validate_bus_name(bus_name)
> return (True, self.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH,
BUS_DAEMON_IFACE,
'StartServiceByName',
'su', (bus_name, flags)))
/usr/lib64/python3.8/site-packages/dbus/bus.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dbus._dbus.SessionBus (session) at 0x7f4eba054950>, bus_name = 'org.freedesktop.DBus', object_path = '/org/freedesktop/DBus'
dbus_interface = 'org.freedesktop.DBus', method = 'StartServiceByName', signature = 'su', args = ('org.kde.kwalletd5', 0), timeout = -1.0, byte_arrays = False, kwargs = {}
get_args_opts = {'byte_arrays': False}
message = <dbus.lowlevel.MethodCallMessage path: /org/freedesktop/DBus, iface: org.freedesktop.DBus, member: StartServiceByName dest: org.freedesktop.DBus>
def call_blocking(self, bus_name, object_path, dbus_interface, method,
signature, args, timeout=-1.0,
byte_arrays=False, **kwargs):
"""Call the given method, synchronously.
:Since: 0.81.0
"""
if object_path == LOCAL_PATH:
raise DBusException('Methods may not be called on the reserved '
'path %s' % LOCAL_PATH)
if dbus_interface == LOCAL_IFACE:
raise DBusException('Methods may not be called on the reserved '
'interface %s' % LOCAL_IFACE)
# no need to validate other args - MethodCallMessage ctor will do
get_args_opts = dict(byte_arrays=byte_arrays)
if is_py2:
get_args_opts['utf8_strings'] = kwargs.get('utf8_strings', False)
elif 'utf8_strings' in kwargs:
raise TypeError("unexpected keyword argument 'utf8_strings'")
message = MethodCallMessage(destination=bus_name,
path=object_path,
interface=dbus_interface,
method=method)
# Add the arguments to the function
try:
message.append(signature=signature, *args)
except Exception as e:
logging.basicConfig()
_logger.error('Unable to set arguments %r according to '
'signature %r: %s: %s',
args, signature, e.__class__, e)
raise
# make a blocking call
> reply_message = self.send_message_with_reply_and_block(
message, timeout)
E dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.
/usr/lib64/python3.8/site-packages/dbus/connection.py:652: DBusException
During handling of the above exception, another exception occurred:
self = <test_kwallet.TestDBusKWallet object at 0x7f4eb958a6a0>
def test_credential(self):
keyring = self.keyring
> cred = keyring.get_credential('service', None)
keyring/testing/backend.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keyring/backends/kwallet.py:129: in get_credential
if not self.connected(service):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <keyring.backends.kwallet.DBusKeyring object at 0x7f4eb958a910>, service = 'service'
def connected(self, service):
if self.handle >= 0:
if self.iface.isOpen(self.handle):
return True
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
wId = 0
try:
remote_obj = bus.get_object(self.bus_name, self.object_path)
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
> raise InitError('Failed to open keyring: %s.' % e)
E keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer..
keyring/backends/kwallet.py:101: InitError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] keyring/testing/backend.py:68: Needs Windows
SKIPPED [1] keyring/testing/backend.py:74: Needs Windows
SKIPPED [1] keyring/testing/backend.py:80: Needs Windows
SKIPPED [1] keyring/testing/backend.py:88: Needs Windows
SKIPPED [1] keyring/testing/backend.py:94: Needs Windows
SKIPPED [1] keyring/testing/backend.py:104: Needs Windows
SKIPPED [1] keyring/testing/backend.py:107: Needs Windows
SKIPPED [1] keyring/testing/backend.py:113: Needs Windows
SKIPPED [1] keyring/testing/backend.py:124: Needs Windows
SKIPPED [1] keyring/testing/backend.py:139: Needs Windows
SKIPPED [1] keyring/testing/backend.py:161: Needs Windows
SKIPPED [1] tests/backends/test_Windows.py:50: Needs Windows
SKIPPED [1] tests/backends/test_Windows.py:53: Needs Windows
SKIPPED [1] tests/backends/test_Windows.py:65: condition: sys.platform != "win32"
SKIPPED [1] keyring/testing/backend.py:68: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:74: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:80: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:88: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:94: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:104: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:107: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:113: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:124: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:139: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:161: KWallet4 unavailable
SKIPPED [1] keyring/testing/backend.py:68: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:74: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:80: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:88: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:94: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:104: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:107: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:113: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:124: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:139: macOS backend not viable
SKIPPED [1] keyring/testing/backend.py:161: macOS backend not viable
XFAIL tests/test_multiprocess.py::test_multiprocess_get
#410: keyring discovery fails intermittently
XFAIL tests/test_multiprocess.py::test_multiprocess_get_after_native_get
#410: keyring discovery fails intermittently
FAILED tests/test_packaging.py::test_entry_point - ValueError: too many values to unpack (expected 1)
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_password_set_get - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnkno...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_difficult_chars - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknow...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_present - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_not_present - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnk...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_one_in_group - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUn...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_unicode_chars - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown:...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_unicode_and_ascii_chars - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.Servi...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_different_user - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_credential - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Co...
=========================================================== 10 failed, 41 passed, 36 skipped, 2 xfailed in 7.85s =========================================================== |
So it appears the issue with assertEqual is fixed. I'm going to close this issue and open up two new issues for the two remaining classes of failure. |
I'm trying to package your module as an rpm package. So I'm using the typical build, install and test cycle used on building packages from non-root account.
I found that few unirs are failing. May I ask for help?
The text was updated successfully, but these errors were encountered: