{"id":23487,"library":"cysystemd","title":"cysystemd","description":"A Python library providing Cython-based bindings for systemd journal and socket activation. Current version 2.0.5, supporting Python 3.8–3.12. Released under MIT license.","status":"active","version":"2.0.5","language":"python","source_language":"en","source_url":"https://github.com/mosquito/cysystemd","tags":["systemd","journal","cython","linux","logging"],"install":[{"cmd":"pip install cysystemd","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"Journal","correct":"from cysystemd.journal import Journal"},{"note":"","wrong":"","symbol":"journal_send","correct":"from cysystemd.journal import journal_send"},{"note":"","wrong":"","symbol":"INotifyFD","correct":"from cysystemd.inotify import INotifyFD"},{"note":"","wrong":"","symbol":"sd_journal_sendv","correct":"from cysystemd.journal import sd_journal_sendv"}],"quickstart":{"code":"import os\nfrom cysystemd.journal import Journal, journal_send\n\n# Send a message to systemd journal\njournal_send(\"Hello from cysystemd\", PRIORITY=6, SYSLOG_IDENTIFIER=\"myapp\")\n\n# Read from journal\nwith Journal() as journal:\n    journal.seek_tail()\n    journal.previous()\n    entry = journal.get_next()\n    print(entry.get('MESSAGE', 'No message'))","lang":"python","description":"Send and read systemd journal messages."},"warnings":[{"fix":"Always check if entry is not None before accessing.","message":"Journal.get_next() returns None when no more entries. Code must handle this.","severity":"gotcha","affected_versions":"all"},{"fix":"Use from cysystemd.journal import ... instead of from systemd.journal import ...","message":"In version 2.0.0, the module structure changed. Old imports from 'systemd.journal' no longer work.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Wrap imports in try/except ImportError or run only on systemd-based systems.","message":"The library requires systemd runtime (e.g., /run/systemd/journal/socket). Importing on non-Linux or without systemd raises ImportError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use journal_send() instead.","message":"sd_journal_sendv() is deprecated in favor of journal_send().","severity":"deprecated","affected_versions":">=1.5.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change import to from cysystemd.journal import ...","cause":"Using old import path from version <2.0.0.","error":"ImportError: No module named 'systemd'"},{"fix":"Ensure systemd is running and journald is active.","cause":"Running on a system without systemd or the journal socket is missing.","error":"OSError: [Errno 2] No such file or directory: '/run/systemd/journal/socket'"},{"fix":"Use journal_send() instead.","cause":"sd_journal_sendv was removed in a recent version.","error":"AttributeError: module 'cysystemd.journal' has no attribute 'sd_journal_sendv'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}