09-27-2020 07:47 AM
script a below:
from acitoolkit.acitoolkit import Session
from acitoolkit.aciphysobject import Node
url ='https://10.10.1.0'
user ='admin'
PASSWORD ='admin'
session=Session(url, user, PASSWORD)
print(session)
if session.login().ok:
print("sucess")
else:
print("failed")
**************************
ouput:
C:\python38\Scripts>apics.py
<acitoolkit.acisession.Session object at 0x000001766BAD79D0>
ERROR:root:Could not relogin to APIC due to ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
failed
C:\python38\Scripts>
please help to fix the login issue
Solved! Go to Solution.
09-28-2020 12:35 PM
Hi @Pradip ,
I'm running out of ideas. I had a quick look at the source code (https://github.com/datacenter/acitoolkit/blob/master/acitoolkit/acisession.py) and can see that the message is thrown by an exception rather than a failure - in other words something didn't work the way it was expected to work. My suspicion is that it is caused by a missing file/directory in your Windows environment. I know that when I tried to install Linux and acitoolkit on Windows10 I had so much trouble with permissions and the like I simply gave up.
If I was in your situation I'd do one of two things:
I must say though, I've NEVER tried to use Docker on a Windows machine, and not sure how that would go.
09-28-2020 01:49 PM
Hi Pardip,
I also tried your script and had no issue.
Are you using a virtual environment? Its a good practice and it might be good to try a clean start on your system.
You can also try your script on a different APIC (like the DevNet Sandbox). It may very well be your environment so if you get the same thing on the Sandbox APIC that is a good data point. If it is environment related, definitely try the virtual environment if you can or try spinning up a linux environment. I like to use Docker. Here are some tips on doing that.
Using a Docker container I did the following:
Form my command line I started a docker container:
claudia@Claudias-iMac ~ % docker run -it cldeluna/disco-immigrant
root@74db0f181da9:/ansible_local# python3 -m venv acitoolkitvenv root@74db0f181da9:/ansible_local# source acitoolkitvenv/bin/activate (acitoolkitvenv) root@74db0f181da9:/ansible_local# pip install acitoolkit (acitoolkitvenv) root@74db0f181da9:/ansible_local# vi apics.py (acitoolkitvenv) root@74db0f181da9:/ansible_local# cat apics.py from acitoolkit.acitoolkit import Session from acitoolkit.aciphysobject import Node url ='https://sandboxapicdc.cisco.com' user ='admin' PASSWORD ='ciscopsdt' session=Session(url, user, PASSWORD) print(session) if session.login().ok: print("success") else: print("failed") (acitoolkitvenv) root@74db0f181da9:/ansible_local# (acitoolkitvenv) root@74db0f181da9:/ansible_local# python apics.py <acitoolkit.acisession.Session object at 0x7fd854f02a58> success
Here is what got installed, in case you want to use the pip freeze output for a requests.txt file but all I did is run pip install acitoolkit.
(acitoolkitvenv) root@74db0f181da9:/ansible_local# pip freeze acitoolkit==0.4 attrs==20.2.0 certifi==2020.6.20 chardet==3.0.4 click==7.1.2 deepdiff==5.0.2 dominate==2.5.2 Flask==1.1.2 Flask-Admin==1.5.6 Flask-Bootstrap==3.3.7.1 Flask-Cors==3.0.9 Flask-HTTPAuth==4.1.0 Flask-SQLAlchemy==2.4.4 Flask-WTF==0.14.3 gitdb==4.0.5 GitPython==3.1.8 graphviz==0.14.1 idna==2.10 importlib-metadata==2.0.0 ipaddress==1.0.23 itsdangerous==1.1.0 Jinja2==2.11.2 jsonschema==3.2.0 MarkupSafe==1.1.1 ordered-set==4.0.2 pkg-resources==0.0.0 py-radix==0.10.0 PyMySQL==0.10.1 pyrsistent==0.17.3 requests==2.24.0 six==1.15.0 smmap==3.0.4 SQLAlchemy==1.3.19 tabulate==0.8.7 urllib3==1.25.10 visitor==0.1.3 websocket-client==0.57.0 Werkzeug==1.0.1 WTForms==2.3.3 zipp==3.2.0 (acitoolkitvenv) root@74db0f181da9:/ansible_local# pip list Package Version ------------------ --------- acitoolkit 0.4 attrs 20.2.0 certifi 2020.6.20 chardet 3.0.4 click 7.1.2 deepdiff 5.0.2 dominate 2.5.2 Flask 1.1.2 Flask-Admin 1.5.6 Flask-Bootstrap 3.3.7.1 Flask-Cors 3.0.9 Flask-HTTPAuth 4.1.0 Flask-SQLAlchemy 2.4.4 Flask-WTF 0.14.3 gitdb 4.0.5 GitPython 3.1.8 graphviz 0.14.1 idna 2.10 importlib-metadata 2.0.0 ipaddress 1.0.23 itsdangerous 1.1.0 Jinja2 2.11.2 jsonschema 3.2.0 MarkupSafe 1.1.1 ordered-set 4.0.2 pip 18.1 pkg-resources 0.0.0 py-radix 0.10.0 PyMySQL 0.10.1 pyrsistent 0.17.3 requests 2.24.0 setuptools 40.8.0 six 1.15.0 smmap 3.0.4 SQLAlchemy 1.3.19 tabulate 0.8.7 urllib3 1.25.10 visitor 0.1.3 websocket-client 0.57.0 Werkzeug 1.0.1 WTForms 2.3.3 zipp 3.2.0 (acitoolkitvenv) root@74db0f181da9:/ansible_local#
09-28-2020 05:02 PM
Hi.
Im going to agree with what others on here have posted that it’s probably your local machine vs APIC. What I would do is uninstall python on your workstation. Go to the directory python was installed at and delete any files within it.
Then install the latest python 3. Then install the acitoolkit again via ‘pip install’ or download the whl. If you continue to have problems, then maybe just try and use a normal POST via requests to see if it works.
Somebody else above recommended trying a different ACI fabric. I agree. Check out developer.cisco.com and find the ACI sandbox and try and connect to that to see if you have the same error. Best of luck
09-27-2020 09:04 AM
Hi,
please help to fix this error...
ERROR:root:Could not relogin to APIC due to ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
09-27-2020 06:47 PM
Hi @Pradip ,
I was not able to re-produce your error.
But for curiosity's sake, can you tell me if you get the same error on:
I found your script worked just fine for me on all three instances
I'm using Python 3.8.2 on Mac OS X Version: 10.15.7 - too hard to get Python working on Windows10
09-27-2020 08:50 PM
Hi Chris, i have checked other apics as well same error found, unfortunately, spines/leaves, we cant access due to policy .
09-27-2020 09:23 PM
OK - One more question. Are you using an OOB IP address or have you set up inband management in the mgmt tenant?
09-28-2020 04:36 AM
Hi Chris, It is OOB ip address.
09-28-2020 12:27 PM
pls help...still issue not resolved
09-28-2020 01:49 PM
Hi Pardip,
I also tried your script and had no issue.
Are you using a virtual environment? Its a good practice and it might be good to try a clean start on your system.
You can also try your script on a different APIC (like the DevNet Sandbox). It may very well be your environment so if you get the same thing on the Sandbox APIC that is a good data point. If it is environment related, definitely try the virtual environment if you can or try spinning up a linux environment. I like to use Docker. Here are some tips on doing that.
Using a Docker container I did the following:
Form my command line I started a docker container:
claudia@Claudias-iMac ~ % docker run -it cldeluna/disco-immigrant
root@74db0f181da9:/ansible_local# python3 -m venv acitoolkitvenv root@74db0f181da9:/ansible_local# source acitoolkitvenv/bin/activate (acitoolkitvenv) root@74db0f181da9:/ansible_local# pip install acitoolkit (acitoolkitvenv) root@74db0f181da9:/ansible_local# vi apics.py (acitoolkitvenv) root@74db0f181da9:/ansible_local# cat apics.py from acitoolkit.acitoolkit import Session from acitoolkit.aciphysobject import Node url ='https://sandboxapicdc.cisco.com' user ='admin' PASSWORD ='ciscopsdt' session=Session(url, user, PASSWORD) print(session) if session.login().ok: print("success") else: print("failed") (acitoolkitvenv) root@74db0f181da9:/ansible_local# (acitoolkitvenv) root@74db0f181da9:/ansible_local# python apics.py <acitoolkit.acisession.Session object at 0x7fd854f02a58> success
Here is what got installed, in case you want to use the pip freeze output for a requests.txt file but all I did is run pip install acitoolkit.
(acitoolkitvenv) root@74db0f181da9:/ansible_local# pip freeze acitoolkit==0.4 attrs==20.2.0 certifi==2020.6.20 chardet==3.0.4 click==7.1.2 deepdiff==5.0.2 dominate==2.5.2 Flask==1.1.2 Flask-Admin==1.5.6 Flask-Bootstrap==3.3.7.1 Flask-Cors==3.0.9 Flask-HTTPAuth==4.1.0 Flask-SQLAlchemy==2.4.4 Flask-WTF==0.14.3 gitdb==4.0.5 GitPython==3.1.8 graphviz==0.14.1 idna==2.10 importlib-metadata==2.0.0 ipaddress==1.0.23 itsdangerous==1.1.0 Jinja2==2.11.2 jsonschema==3.2.0 MarkupSafe==1.1.1 ordered-set==4.0.2 pkg-resources==0.0.0 py-radix==0.10.0 PyMySQL==0.10.1 pyrsistent==0.17.3 requests==2.24.0 six==1.15.0 smmap==3.0.4 SQLAlchemy==1.3.19 tabulate==0.8.7 urllib3==1.25.10 visitor==0.1.3 websocket-client==0.57.0 Werkzeug==1.0.1 WTForms==2.3.3 zipp==3.2.0 (acitoolkitvenv) root@74db0f181da9:/ansible_local# pip list Package Version ------------------ --------- acitoolkit 0.4 attrs 20.2.0 certifi 2020.6.20 chardet 3.0.4 click 7.1.2 deepdiff 5.0.2 dominate 2.5.2 Flask 1.1.2 Flask-Admin 1.5.6 Flask-Bootstrap 3.3.7.1 Flask-Cors 3.0.9 Flask-HTTPAuth 4.1.0 Flask-SQLAlchemy 2.4.4 Flask-WTF 0.14.3 gitdb 4.0.5 GitPython 3.1.8 graphviz 0.14.1 idna 2.10 importlib-metadata 2.0.0 ipaddress 1.0.23 itsdangerous 1.1.0 Jinja2 2.11.2 jsonschema 3.2.0 MarkupSafe 1.1.1 ordered-set 4.0.2 pip 18.1 pkg-resources 0.0.0 py-radix 0.10.0 PyMySQL 0.10.1 pyrsistent 0.17.3 requests 2.24.0 setuptools 40.8.0 six 1.15.0 smmap 3.0.4 SQLAlchemy 1.3.19 tabulate 0.8.7 urllib3 1.25.10 visitor 0.1.3 websocket-client 0.57.0 Werkzeug 1.0.1 WTForms 2.3.3 zipp 3.2.0 (acitoolkitvenv) root@74db0f181da9:/ansible_local#
09-27-2020 09:16 PM
chris, also want to let you know that it was working before , but some reason i did uninstall acitoolkit , install again..then issue started,
i tried everything, even i uninstall python, all the pakages... really tired....last 5 days, i am working on that..but no solution...really appreciated , what could be the soultion to fix this....
09-28-2020 12:35 PM
Hi @Pradip ,
I'm running out of ideas. I had a quick look at the source code (https://github.com/datacenter/acitoolkit/blob/master/acitoolkit/acisession.py) and can see that the message is thrown by an exception rather than a failure - in other words something didn't work the way it was expected to work. My suspicion is that it is caused by a missing file/directory in your Windows environment. I know that when I tried to install Linux and acitoolkit on Windows10 I had so much trouble with permissions and the like I simply gave up.
If I was in your situation I'd do one of two things:
I must say though, I've NEVER tried to use Docker on a Windows machine, and not sure how that would go.
09-28-2020 05:02 PM
Hi.
Im going to agree with what others on here have posted that it’s probably your local machine vs APIC. What I would do is uninstall python on your workstation. Go to the directory python was installed at and delete any files within it.
Then install the latest python 3. Then install the acitoolkit again via ‘pip install’ or download the whl. If you continue to have problems, then maybe just try and use a normal POST via requests to see if it works.
Somebody else above recommended trying a different ACI fabric. I agree. Check out developer.cisco.com and find the ACI sandbox and try and connect to that to see if you have the same error. Best of luck
09-28-2020 09:34 PM
thanks chris,Claudias & Brandon....over your helps, issue was related to local machine, nothing related with apic, i did clean everything includes pycharm, ven, install python, acitoolkit......
thanks..!! helps...was trying from last 1 week... thanks a millions...!!
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