cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
768
Views
5
Helpful
1
Replies

ACI Toolkit Error

Maaz.Javed
Level 1
Level 1

Hi im using the ACI toolkit to create an epg but im getting the following error:

line 6, in <module>
from acitoolkit import Credentials, Session, Tenant, AppProfile, BridgeDomain, EPG
File "C:\Users\u28057\AppData\Roaming\Python\Python310\site-packages\acitoolkit\__init__.py", line 35, in <module>
from .acitoolkit import ( # noqa
File "C:\Users\u28057\AppData\Roaming\Python\Python310\site-packages\acitoolkit\acitoolkit.py", line 33, in <module>
from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py)

 

here is the script that im using:

"""
Sample of creating a EPG
"""
import json
from acitoolkit import Credentials, Session, Tenant, AppProfile, BridgeDomain, EPG
import sys

# Modify the LOGIN, PASSWORD, URL
LOGIN    = "LOGIN"
PASSWORD = "PASSWORD"
URL      = "URL"

def main():
    """
    Main execution routine
    :return: None
    """
    creds = Credentials('apic')
    creds.add_argument('--tenant', help='The name of Tenant')
    creds.add_argument('--app', help='The name of ApplicationProfile')
    creds.add_argument('--bd', help='The name of BridgeDomain')
    creds.add_argument('--epg', help='The name of EPG')
    creds.add_argument('--json', const='false', nargs='?', help='Json output only')

    args = creds.get()
    session = Session(args.url, args.login, args.password)
    session.login()

    tenant = Tenant(args.tenant)
    app = AppProfile(args.app, tenant)
    bd = BridgeDomain(args.bd, tenant)
    epg = EPG(args.epg, app)
    epg.add_bd(bd)

    if args.json:
        print(tenant.get_json())
    else:
        resp = session.push_to_apic(tenant.get_url(),
                                    tenant.get_json())

        if not resp.ok:
            print('%% Error: Could not push configuration to APIC')
            print(resp.text)

if __name__ == '__main__':
    main()

 

 

1 Accepted Solution

Accepted Solutions

Sergiu.Daniluk
VIP Alumni
VIP Alumni

Hi @Maaz.Javed 

The problem you see is not with ACI toolkit, but with collections, which apparently changed in py3.10:

ImportError: cannot import name 'Sequence' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py)

If you search on google the error you will find tons of discussions.

However, for you the solution would not work, unless you modify the ACI toolkit module itself.

I would recommend you use an older version of python, like 3.9 - easier this way.

Take care,

Sergiu

View solution in original post

1 Reply 1

Sergiu.Daniluk
VIP Alumni
VIP Alumni

Hi @Maaz.Javed 

The problem you see is not with ACI toolkit, but with collections, which apparently changed in py3.10:

ImportError: cannot import name 'Sequence' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py)

If you search on google the error you will find tons of discussions.

However, for you the solution would not work, unless you modify the ACI toolkit module itself.

I would recommend you use an older version of python, like 3.9 - easier this way.

Take care,

Sergiu

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License