Skip to content

Lib not working in Python 3.9.7 #689

@PaulFarault

Description

@PaulFarault

The lib is not working with Python 3.9.7, the following error is raised:

Traceback (most recent call last):
  File "/home/paul/code/tosit/lib/venv3.9.7/bin/tdp", line 6, in <module>
    sys.exit(cli())
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/click/core.py", line 914, in make_context
    self.parse_args(ctx, args)
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/click/core.py", line 1370, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/click/core.py", line 2347, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/click/core.py", line 2309, in process_value
    value = self.callback(ctx, self, value)
  File "/home/paul/code/tosit/lib/tdp/cli/params.py", line 89, in _create_collections_callback
    from tdp.core.collections import Collections
  File "/home/paul/code/tosit/lib/tdp/core/collections/__init__.py", line 4, in <module>
    from .collections import Collections
  File "/home/paul/code/tosit/lib/tdp/core/collections/collections.py", line 30, in <module>
    from tdp.core.inventory_reader import InventoryReader
  File "/home/paul/code/tosit/lib/tdp/core/inventory_reader.py", line 9, in <module>
    from tdp.core.collections.playbook_validate import PlaybookIn
  File "/home/paul/code/tosit/lib/tdp/core/collections/playbook_validate.py", line 44, in <module>
    class PlaybookIn(RootModel[conlist(_PlaybookPlayIn, min_length=1)]):
  File "/home/paul/code/tosit/lib/venv3.9.7/lib/python3.9/site-packages/pydantic/types.py", line 869, in conlist
    return Annotated[List[item_type], annotated_types.Len(min_length or 0, max_length)]
TypeError: Len() takes no arguments

This seems to be an error specif to Python 3.9.7: https://bugs.python.org/issue45081

We should exclude this version.

Note: error was mentioned by @SteBaum in #688

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions