Jeepney

raw JSON →
0.9.0 verified Tue May 12 auth: no python install: stale quickstart: stale

Jeepney is a low-level, pure Python D-Bus protocol wrapper, currently at version 0.9.0, designed for interprocess communication on desktop Linux systems. It offers a non-magical approach to D-Bus, requiring more explicit code compared to other interfaces like dbus-python or pydbus. Jeepney is actively maintained with a release cadence of approximately one major version per year.

pip install jeepney
error jeepney.wrappers.DBusErrorResponse: [org.freedesktop.DBus.Error.UnknownMethod] ("No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/secrets/collection/login",)
cause This error occurs when a D-Bus method call is made to an object, but the specified interface or method does not exist on that object, or the object path is incorrect.
fix
Verify the correct D-Bus object_path, bus_name, interface, and method_name according to the D-Bus service's documentation. For instance, ensure the interface is explicitly defined for the method call, as in dbus.Interface(obj, dbus_interface='org.freedesktop.Hal.Device') if using dbus-python or by correctly structuring DBusAddress for jeepney.
error KeyError: 'DBUS_SESSION_BUS_ADDRESS'
cause This error arises when `jeepney` attempts to connect to the D-Bus session bus (which is the default) but the `DBUS_SESSION_BUS_ADDRESS` environment variable is not set, typically in non-desktop environments, when running under `sudo --preserve-env` without a D-Bus session, or in containerized environments.
fix
Ensure that the DBUS_SESSION_BUS_ADDRESS environment variable is correctly set in the environment where the Python script is executed. If running in a script without a graphical session, consider connecting to the system bus explicitly using open_dbus_connection(bus='SYSTEM') or set up the D-Bus session environment variables before running the script (e.g., export $(dbus-launch) or export $(gnome-settings-daemon --start) followed by dbus-update-activation-environment).
error BrokenPipeError: [Errno 32] Broken pipe
cause This is an OSError subclass indicating that the D-Bus connection was unexpectedly closed by the peer, meaning the D-Bus daemon or the service being communicated with terminated the connection or stopped listening.
fix
Ensure the D-Bus daemon is running and healthy on the system. Check the status of the D-Bus service you are trying to communicate with. Implement robust error handling (e.g., try...except BrokenPipeError) to gracefully manage unexpected disconnections and potentially attempt to re-establish the connection.
error ModuleNotFoundError: No module named 'jeepney.io.blocking'
cause This error occurs when the Python interpreter cannot find the specified submodule, typically because `jeepney` was not installed correctly, the Python environment is not configured to include `jeepney`'s installed path, or there is a typo in the import statement.
fix
First, ensure jeepney is installed in your active Python environment: pip install jeepney. If it is installed, verify the import path is correct and matches the version of jeepney (e.g., from jeepney.io.blocking import open_dbus_connection). Check your Python environment's sys.path to ensure the installation directory is included.
breaking The deprecated 'connection.router' API has been removed in version 0.9.0. Use proxies or 'send_and_get_reply()' for routing replies to method calls, and 'filter()' for other routing needs.
fix Update your code to utilize proxies or 'send_and_get_reply()' for method call replies, and 'filter()' for other routing functionalities.
breaking The 'unwrap' parameter from 'send_and_get_reply' in the blocking integration has been removed in version 0.9.0.
fix Remove the 'unwrap' parameter from 'send_and_get_reply' calls in your code.
breaking The 'DBusConnection' class is no longer directly importable from the top-level 'jeepney' package due to module reorganization.
fix Update your import statement. Depending on your integration, you should import 'DBusConnection' from a submodule, e.g., 'from jeepney.blocking import DBusConnection' for blocking I/O, or 'from jeepney.io.asyncio import DBusConnection' for asyncio.
breaking The 'DBusConnection' class is no longer directly importable from the top-level 'jeepney' package. It has been moved to a submodule, typically 'jeepney.blocking' for blocking connections or similar for other types of connections.
fix Update your imports from `from jeepney import DBusConnection` to `from jeepney.blocking import DBusConnection` or the appropriate submodule where it now resides.
python os / libc status wheel install import disk
3.10 alpine (musl) - - - -
3.10 slim (glibc) - - - -
3.11 alpine (musl) - - - -
3.11 slim (glibc) - - - -
3.12 alpine (musl) - - - -
3.12 slim (glibc) - - - -
3.13 alpine (musl) - - - -
3.13 slim (glibc) - - - -
3.9 alpine (musl) - - - -
3.9 slim (glibc) - - - -

A basic example demonstrating how to import and use DBusConnection from jeepney to interact with D-Bus services.

import os
from jeepney import DBusConnection

# Establish a connection to the D-Bus session bus
connection = DBusConnection()

# Use the connection to interact with D-Bus services
# For example, to call a method on a service:
# response = connection.call(service_name, method_name, args)

# Remember to handle exceptions and manage the connection lifecycle appropriately