Netmiko: Can't import ConnectHandler (MacOSX & CentOS)

Created on 5 Sep 2017  路  2Comments  路  Source: ktbyers/netmiko

Hi,

Using a virtualenv, I am unable to run the following:

!/usr/bin/env python3

import argparse
import logging
import sys
import os

from netmiko import ConnectHandler

It works fine in the console with the python 3.6.2 interpreter (same as my virtual environment).
I see that is says py3.5 is what's supported, but I have the same issue with 2.7.

I get this:

` Traceback (most recent call last):
File "/Users/punkrokk/repos/netmiko/netmiko.py", line 8, in
from netmiko import ConnectHandler
File "/Users/punkrokk/repos/netmiko/netmiko.py", line 8, in
from netmiko import ConnectHandler
ImportError: cannot import name 'ConnectHandler'

Process finished with exit code 1 `

Any thoughts on troubleshooting?

Most helpful comment

@punkrokk It looks like you have created a file name netmiko.py and it is trying to import from that and not from the netmiko library:

/Users/punkrokk/repos/irflow-integrations/integrations/netmiko/netmiko.py

You need to rename this file and remove any .pyc files that were created.

All 2 comments

@punkrokk It looks like you have created a file name netmiko.py and it is trying to import from that and not from the netmiko library:

/Users/punkrokk/repos/irflow-integrations/integrations/netmiko/netmiko.py

You need to rename this file and remove any .pyc files that were created.

that was it! thanks @ktbyers

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ktbyers picture ktbyers  路  7Comments

Murali24872019 picture Murali24872019  路  6Comments

ktbyers picture ktbyers  路  5Comments

edurguti picture edurguti  路  7Comments

NedySuprianto picture NedySuprianto  路  3Comments