10-15-2016 11:11 PM - edited 06-04-2019 02:26 AM
As per the instruction I need to do the following
1. SSH to switch using provided credentials.
2. Run ‘run bash’ to go to bash shell.
3. Goto directory /home/cisco/subscripts/python
4. Copy the required files to /isan/python/scripts/cisco directory. For example, if you want to manage interface configuration using python, copy test_interface.py to /isan/python/scripts/cisco directory.
5. Execute following command to run the script python –m cisco.test_interface The format of the command to be executed is, bash> python -m .
When i run python –m cisco.test_interface it fails with the error
Could not import runpy module
What am I doing wrong here?
Thanks
10-17-2016 05:38 AM
Hello Zeeshan,
I'm not exactly sure if you're trying to run this code locally or in the lab, but generally in python when you see this error the python script is referencing a library that it doesn't have access too. Try this:
pip install runpy
-or-
python pip install runpy
Also, could you open up the python application and send me any line that has "import" in front of it? They should be mostly at the top of the script.
Thanks!
Jacob
10-22-2016 12:11 AM
Thanks jacob ..I trying to run it in the lab.. ssh to the switch.. start bash.. copy the script and run it..
the import statements are
import cli
import json
i am trying to run some examples from GitHub - datacenter/who-moved-my-cli: A collection of simple Python scripts to help convert network engineers into progr…
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