Skip to content

Python 3.10 compatibility #13

@anteverse

Description

@anteverse

Hi,

It seems cgroupspy is not working with python 3.10 with this kind of error:

ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

As per Python collections documentation, Iterable has been moved to collections.abc since 3.3 and left for compatibility until 3.9 included: https://docs.python.org/3.9/library/collections.html.

A suggestion for cgroupspy/interfaces.py:

Replace

from collections import Iterable

By

if sys.version_info.major == 3 and sys.version_info.minor >= 3:
    from collections.abc import Iterable
else:
    from collections import Iterable

or equivalent in order to have a distinction between Python 3.3 and older.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions