napalm-automation-community / napalm-dellos10

NAPALM Driver for Dell EMC OS10 Enterprise
http://dellos10-napalm.readthedocs.io/en/latest/
Apache License 2.0
10 stars 11 forks source link

py23_compat broken with napalm 3.0.1 #21

Closed joltcan closed 4 years ago

joltcan commented 4 years ago

I'm trying to run napalm-dellos10 1.0.6, and I get this error when selecting the driver on Python3 in venv:

>>> from napalm import get_network_driver
>>> d = get_network_driver('dellos10')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/__init__.py", line 95, in get_network_driver
    raise e
  File "/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/__init__.py", line 86, in get_network_driver
    module = importlib.import_module(module_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/netbox/venv/lib/python3.7/site-packages/napalm_dellos10/__init__.py", line 18, in <module>
    from napalm_dellos10.dellos10 import DellOS10Driver
  File "/opt/netbox/venv/lib/python3.7/site-packages/napalm_dellos10/dellos10.py", line 34, in <module>
    from napalm.base.utils import py23_compat
ImportError: cannot import name 'py23_compat' from 'napalm.base.utils' (/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/utils/__init__.py)

Can it be that it is missing, I get no rows doing grep -ri py23 /opt/netbox/venv/lib/python3.7/site-packages/napalm/base/*

Thank you!

javeedf commented 4 years ago

Please try the below code. also, follow the https://dellos10-napalm.readthedocs.io/ for more information

from napalm.base import get_network_driver d = get_network_driver('dellos10') e = d('<HOSTNAME/IP_ADDRESS>', '', '', optional_args={'global_delay_factor': 3}) e.open() e.get_facts() e.close()

javeedf commented 4 years ago

@joltcan see above ^^

joltcan commented 4 years ago

Same thing :/

from napalm.base import get_network_driver d = get_network_driver('dellos10') Traceback (most recent call last): File "", line 1, in File "/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/init.py", line 95, in get_network_driver raise e File "/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/init.py", line 86, in get_network_driver module = importlib.import_module(module_name) File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/opt/netbox/venv/lib/python3.7/site-packages/napalm_dellos10/init.py", line 18, in from napalm_dellos10.dellos10 import DellOS10Driver File "/opt/netbox/venv/lib/python3.7/site-packages/napalm_dellos10/dellos10.py", line 34, in from napalm.base.utils import py23_compat ImportError: cannot import name 'py23_compat' from 'napalm.base.utils' (/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/utils/init.py)`

javeedf commented 4 years ago

@joltcan Added fix on the master branch. Could you please check if that helps?

joltcan commented 4 years ago

First, excuse my pip/python skills. Second, same issue.

(venv) netbox@c1-mgmt:~$ python3 Python 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. from napalm import get_network_driver d = get_network_driver('dellos10') Traceback (most recent call last): File "", line 1, in File "/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/init.py", line 95, in get_network_driver raise e File "/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/init.py", line 86, in get_network_driver module = importlib.import_module(module_name) File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/opt/netbox/venv/lib/python3.7/site-packages/napalm_dellos10/init.py", line 18, in from napalm_dellos10.dellos10 import DellOS10Driver File "/opt/netbox/venv/lib/python3.7/site-packages/napalm_dellos10/dellos10.py", line 34, in from napalm.base.utils import py23_compat ImportError: cannot import name 'py23_compat' from 'napalm.base.utils' (/opt/netbox/venv/lib/python3.7/site-packages/napalm/base/utils/init.py)

I did a pip3 install --upgrade napalm-dellos10 first:

(venv) netbox@c1-mgmt:~$ pip3 list |grep napalm napalm 3.0.1 napalm-dellos10 1.0.6

It's a debian buster box where I installed setup-tools, installed pip3 and everything has bin run in venv after that (both install of netbox and napalm).

javeedf commented 4 years ago

@joltcan Could you please upgrade to the latest and try again?

joltcan commented 4 years ago

We have a winner! Works great. Thanks!