Bug 77086 - python-systemd: Incompatibility with Python 3.x UUID class
Summary: python-systemd: Incompatibility with Python 3.x UUID class
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-05 16:29 UTC by Sebastian Wicki
Modified: 2014-04-05 17:32 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Sebastian Wicki 2014-04-05 16:29:04 UTC
Using the UUID class in the systemd.journal module in Python 3.x causes an
AttributeError. The problem seems to be that the python-systemd wrapper is using
the undocumented UUID.get_hex() method. This undocumented, private method is
present in Python 2.7, but not in Python 3.x.

The documented way to retrieve the hex string is the UUID.hex attribute:
See: https://docs.python.org/3/library/uuid.html#uuid.UUID.hex

systemd version: 212

Relevant python tracebacks:

    $ python3
    Python 3.4.0 (default, Mar 17 2014, 23:20:09)
    [GCC 4.8.2 20140206 (prerelease)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from systemd import journal
    >>> from uuid import UUID
    >>>
    >>> journal.get_catalog(UUID('0123456789ABCDEF0123456789ABCDEF'))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.4/site-packages/systemd/journal.py", line 349, in get_catalog
        mid = mid.get_hex()
    AttributeError: 'UUID' object has no attribute 'get_hex'
    >>>
    >>> j=journal.Reader()
    >>> j.messageid_match(UUID('0123456789ABCDEF0123456789ABCDEF'))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.3/site-packages/systemd/journal.py", line 317, in messageid_match
        messageid = messageid.get_hex()
    AttributeError: 'UUID' object has no attribute 'get_hex'
    >>>
    >>> j=journal.Reader()
    >>> j.seek_monotonic(0, UUID('0123456789ABCDEF0123456789ABCDEF'))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.3/site-packages/systemd/journal.py", line 296, in seek_monotonic
        bootid = bootid.get_hex()
    AttributeError: 'UUID' object has no attribute 'get_hex'
Comment 1 Zbigniew Jedrzejewski-Szmek 2014-04-05 17:32:48 UTC
Thanks for the report. I really need to write a test suite :(

Fixed in http://cgit.freedesktop.org/systemd/systemd/commit/?id=b532cf3,
and follow-up http://cgit.freedesktop.org/systemd/systemd/commit/?id=b65f242.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.