10-27-2014 05:17 PM
HI, Guys
I'm using Python2.7 and ACI SDK, and i can create Tenant into my APIC successfully.
But When i try to create Tenant from ACI-toolkit, i got the error:
Thanks for your sharing
Jason
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from acitoolkit import *
>>> from credentails import *
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from credentails import *
ImportError: No module named credentails // so i using the following to login
>>> apicUrl = 'https://my-aci-address'
>>> from cobra.mit.access import MoDirectory
>>> from cobra.mit.session import LoginSession
>>> loginSession = LoginSession(apicUrl,'admin','cisco123')
>>> moDir = MoDirectory(loginSession)
>>> moDir.login()
>>> tenant = Tenant ('chungewa-ten2')
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
tenant = Tenant ('chungewa-ten2')
NameError: name 'Tenant' is not defined where am I wrong
Solved! Go to Solution.
10-31-2014 07:37 PM
Hello,
Here is some information in the samples/README.md
"Many of the samples in this directory use the file credentials.py to login to the APIC. Before running, edit the credentials.py with the username, password, and IP address for your environment."
So create a credentials.py file in the same directory as your code and have in it values for URL, LOGIN and PASSWORD as the credentials to access the APIC. Below is an example.
## credentials.py
URL="http://127.0.0.1"
LOGIN="chungewa"
PASSWORD="Cisco123"
- Omar
10-28-2014 08:20 AM
Hi Jason,
It looks to me that you need to do a couple of things:
First,
from acitoolkit.acitoolkit import *
instead of
from acitoolkit import *
Second, check the spelling of credentials. You spell it as credentails ("a" and "i" are reversed). I do not know if that is intentional.
- Omar
10-31-2014 07:24 PM
HI, Omar
after reinstall acitoolkit, i'v referenced this http://datacenter.github.io/acitoolkit/docsbuild/html/tutorial.html#building-a-simple-tenant-configuration
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from acitoolkit.acitoolkit import *
>>> from credentials import * //copied from in above URL
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from credentials import *
ImportError: No module named credentials
10-31-2014 07:37 PM
Hello,
Here is some information in the samples/README.md
"Many of the samples in this directory use the file credentials.py to login to the APIC. Before running, edit the credentials.py with the username, password, and IP address for your environment."
So create a credentials.py file in the same directory as your code and have in it values for URL, LOGIN and PASSWORD as the credentials to access the APIC. Below is an example.
## credentials.py
URL="http://127.0.0.1"
LOGIN="chungewa"
PASSWORD="Cisco123"
- Omar
10-31-2014 07:55 PM
Thanks Omar:
modify credentials.py and put under my python2.7 directory, that works.
08-08-2016 09:05 PM
I am having the same issue.. But it's not credential related..
$ python aci-doc.py
Traceback (most recent call last):
File "aci-doc.py", line 4, in <module>
import cobra.mit.access
ImportError: No module named cobra.mit.access
I've searched and I don't appear to have this module anywhere.. Does anyone know a location to download it from? I've seen it on "ReadTheDocs" website, but nothing official that I can find on Cisco.
06-16-2019 10:02 AM - edited 10-22-2022 10:31 AM
Have you installed SDK Cobra egg files? Are you using Python 2.7 or 3?
Python 3 does not work. The whole thing works under Pyhton 2.7.
Regards
Wassim
07-30-2020 10:07 PM
The Cobra SDK files are typically downloaded from a physical APIC appliance.
wget https://d1nmyq4gcgsfi5.cloudfront.net/fileMedia/1f3d41ce-d154-44e3-74c1-d6cf3b525eaa/acicobra-4.2_3h-py2.py3-none-any.whl
wget https://d1nmyq4gcgsfi5.cloudfront.net/fileMedia/b3b69aa3-891b-41ff-46db-a73b4b215860/acimodel-4.2_3h-py2.py3-none-any.whl
12-09-2019 06:31 AM
I'm also having some trouble importing the acitoolkit module.
This is the error that I get:
>>> from acitoolkit.acitoolkit import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build\bdist.win-amd64\egg\acitoolkit\__init__.py", line 30, in <module> File "build\bdist.win-amd64\egg\acitoolkit\aciFaults.py", line 6, in <module> File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\jsonschema-3.2.0-py2.7.egg\jsonschema\__init__.py", line 33, in <module> import importlib_metadata as metadata File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\importlib_metadata-1.2.0-py2.7.egg\importlib_metadata\__init__.py", line 9, in <module> import zipp File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\zipp-0.6.0-py2.7.egg\zipp.py", line 12, in <module> import more_itertools File "build\bdist.win-amd64\egg\more_itertools\__init__.py", line 1, in <module> File "C:\Users\dfvieiragoncalves\code\py2-venv\lib\site-packages\more_itertools-8.0.2-py2.7.egg\more_itertools\more.py", line 460 yield from iterable ^ SyntaxError: invalid syntax
12-17-2019 12:47 PM
I have the same problem
12-17-2019 01:29 PM
Following commands solved the problem:
pip2 uninstall more_itertools
pip2 install more_itertools==5.0.0
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide