diff --git a/ntc_templates/parse.py b/ntc_templates/parse.py index b96d9dc17b..c24ca2cd4c 100644 --- a/ntc_templates/parse.py +++ b/ntc_templates/parse.py @@ -1,8 +1,10 @@ """ntc_templates.parse.""" import os import sys -from textfsm.clitable import CliTableError -import textfsm.clitable as clitable +try: + from textfsm import clitable +except ImportError: + import clitable def _get_template_dir(): @@ -36,7 +38,7 @@ def parse_output(platform=None, command=None, data=None): try: cli_table.ParseCmd(data, attrs) structured_data = _clitable_to_dict(cli_table) - except CliTableError as e: + except clitable.CliTableError as e: raise Exception('Unable to parse command "%s" on platform %s - %s' % (command, platform, str(e))) # Invalid or Missing template # module.fail_json(msg='parsing error', error=str(e))