systemd-python provides a Python interface for libsystemd, allowing Python applications to interact with systemd components like the journal, daemon management, and unit control. The current version is 235. Releases are infrequent and typically tied to major systemd project releases.
pip install systemd-pythonVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to send a log message to the systemd journal using the `Journal` class. It includes custom fields for better discoverability and provides an error message if systemd-journald is not available, which is common when running on non-systemd systems or without proper access.
Prefer using your distribution's package manager to install `python3-systemd`.
Ensure your environment is a systemd-based Linux distribution. For cross-platform applications, consider abstracting systemd-specific functionality.
Consult systemd documentation for specific error codes and expected behavior. Implement robust `try-except` blocks for `systemd.journal.JournaldError` or `systemd.SystemdError`. Be mindful of process privileges.
No dependency data recorded yet.