pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.38k stars 367 forks source link

Issue on Python 3.10 #840

Closed ChrisOForgeFlow closed 2 years ago

ChrisOForgeFlow commented 2 years ago

I have this issue with python3.10

Traceback (most recent call last):
  File "/home/christopher/.local/bin/invoke", line 8, in <module>
    sys.exit(program.run())
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/program.py", line 373, in run
    self.parse_collection()
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/program.py", line 465, in parse_collection
    self.load_collection()
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/program.py", line 696, in load_collection
    module, parent = loader.load(coll_name)
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/loader.py", line 76, in load
    module = imp.load_module(name, fd, path, desc)
  File "/usr/lib/python3.10/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.10/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 719, in _load
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/christopher/Documents/odoo/forgeflow/customer/kencove/14.0/tasks.py", line 24, in <module>
    yaml.safe_load((PROJECT_ROOT / "common.yaml").read_text())["services"]["odoo"][
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/vendor/yaml3/__init__.py", line 94, in safe_load
    return load(stream, SafeLoader)
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/vendor/yaml3/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/vendor/yaml3/constructor.py", line 37, in get_single_data
    return self.construct_document(node)
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/vendor/yaml3/constructor.py", line 46, in construct_document
    for dummy in generator:
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/vendor/yaml3/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/vendor/yaml3/constructor.py", line 204, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/home/christopher/.local/lib/python3.10/site-packages/invoke/vendor/yaml3/constructor.py", line 126, in construct_mapping
    if not isinstance(key, collections.Hashable):
AttributeError: module 'collections' has no attribute 'Hashable'

On my enviroment I applied this change and works

https://github.com/ablab/spades/issues/873#issuecomment-1011073085

neozenith commented 2 years ago

Thanks for reporting this. If there is a fix, opening a PR would be appreciated.

bitprophet commented 2 years ago

I think this was fixed in #803 - please try upgrading to 1.7! 🙌🏻