datacenter / acitoolkit

A basic toolkit for accessing the Cisco APIC
Other
347 stars 266 forks source link

ImportError: cannot import name 'Sequence' from 'collections' for python >= v3.10 #377

Closed PratyushBasu closed 2 years ago

PratyushBasu commented 2 years ago

OS: Windows 10 ( I'm using it, unsure about other OSes)

Issue: When I'm trying to use the acitoolkit package v0.4 with Python 3.10, I'm getting the following error: "ImportError: cannot import name 'Sequence' from 'collections'"

Reason: The Sequence module has been moved under (_collections_abc module, finally referred from collections.abc module)

Solution:

  1. Use Python version <=3.9
  2. Change the import in acitoolkit.py file as below was: from collections import Sequence to-be:
    try:
    from collections import Sequence
    except ImportError:
    from collections.abc import Sequence

Feel free to suggest on alternative approaches.

Regards, Pratyush

PratyushBasu commented 2 years ago

fixed it : https://github.com/datacenter/acitoolkit/pull/378

Regards, Pratyush