Skip to content

AttributeError: module 'collections' has no attribute 'Iterable' #32

Description

@kenorb

Using the latest master, I've got the following errors:

/opt/hostedtoolcache/Python/3.10.2/x64/bin/pre-commit run --show-diff-on-failure --color=always --all-files
...
jinjalint...................................................................Failed
- hook id: jinjalint
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repobsmo5jsj/py_env-python3/bin/jinjalint", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.cache/pre-commit/repobsmo5jsj/py_env-python3/lib/python3.10/site-packages/jinjalint/cli.py", line 63, in main
    paths = list(resolve_file_paths(input_names, extensions=extensions))
  File "/home/runner/.cache/pre-commit/repobsmo5jsj/py_env-python3/lib/python3.10/site-packages/jinjalint/util.py", line 9, in flatten
    if (isinstance(el, collections.Iterable) and
AttributeError: module 'collections' has no attribute 'Iterable'
Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repobsmo5jsj/py_env-python3/bin/jinjalint", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.cache/pre-commit/repobsmo5jsj/py_env-python3/lib/python3.10/site-packages/jinjalint/cli.py", line 63, in main
    paths = list(resolve_file_paths(input_names, extensions=extensions))
  File "/home/runner/.cache/pre-commit/repobsmo5jsj/py_env-python3/lib/python3.10/site-packages/jinjalint/util.py", line 9, in flatten
    if (isinstance(el, collections.Iterable) and
AttributeError: module 'collections' has no attribute 'Iterable'

The error happens with Python v3.10.2. Works fine with v3.9.7 and v3.9.10.

Action file:

jobs:
  Pre-commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1
        with:
          path: ~/.cache/pre-commit
          key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
      - uses: actions/setup-python@v1
      - uses: pre-commit/action@v2.0.3

Pre-commit config file:

...
  - repo: https://github.com/motet-a/jinjalint
    rev: master
    hooks:
      - id: jinjalint

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions