tc45 / GetInventory

Batch Network Device Detail Collector (Cisco)
MIT License
23 stars 9 forks source link

ModuleNotFoundError: No module named 'netmiko.ssh_exception' - Help Me #17

Open vsharma789 opened 2 years ago

vsharma789 commented 2 years ago

Hi Friends,

I am new to Python scripting, I am trying to use GetInventory. While running script i am getting below error. I have tried to upgrade netmiko, reinstall python also.

Kindly help me.

C:\python\GetInventory>python main.py Traceback (most recent call last): File "C:\python\GetInventory\main.py", line 2, in import getinventory File "C:\python\GetInventory\getinventory__init__.py", line 1, in from .project import GetInventoryProject File "C:\python\GetInventory\getinventory\project.py", line 7, in from . import networkdevice File "C:\python\GetInventory\getinventory\networkdevice.py", line 8, in from netmiko.ssh_exception import AuthenticationException ModuleNotFoundError: No module named 'netmiko.ssh_exception'

ben-ocn commented 2 years ago

To fix this first error, I had to open networkdevice.py and change: from netmiko.ssh_exception import AuthenticationException to this: from netmiko.exceptions import AuthenticationException using netmiko 4.1.2

Second item I needed to modify was: <your path>/python3.10/site-packages/netcapt/get_network_device.py Comment out these two lines:

    if kwargs['verbose']:
        print('Auto detecting device type for:', kwargs['host'])

Given some time I'll come back and try to understand why this was broken.

Third item I found was that the _gather_command.txt files were overwriting with each iteration (only the output of the last command was in the file). So in the _dev_data_to_txt function within project.py I changed: f_path.write_file(msg) to this: f_path.write_file(msg, mode="a")

This has the flaw of adding to the files on each subsequent run, but I was just looking to get this running. Maybe when I have more time I'll come back and figure out a better way to do this, but for now it 'works'.

Hope this helps.

tc45 commented 2 years ago

It should like you haven't installed requirements.  All modules in the 'requirements.txt' file must be installed.  The easiest way to do this is with pip using the command 'pip install -r requirements.txt'. Please make sure you follow the guide on github for installation and usage. Tony On Monday, August 1, 2022 at 10:09:32 AM EDT, vsharma789 @.***> wrote:

Hi Friends,

I am new to Python scripting, I am trying to use GetInventory. While running script i am getting below error. I have tried to upgrade netmiko, reinstall python also.

Kindly help me.

C:\python\GetInventory>python main.py Traceback (most recent call last): File "C:\python\GetInventory\main.py", line 2, in import getinventory File "C:\python\GetInventory\getinventoryinit.py", line 1, in from .project import GetInventoryProject File "C:\python\GetInventory\getinventory\project.py", line 7, in from . import networkdevice File "C:\python\GetInventory\getinventory\networkdevice.py", line 8, in from netmiko.ssh_exception import AuthenticationException ModuleNotFoundError: No module named 'netmiko.ssh_exception'

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>