Skip to content

Commit 02a2fd1

Browse files
laalvaregahan9
authored andcommitted
Chain import exceptions for tools.restricted.EnableXmlCli and tools.EnableXmlCli
1 parent 2a01b73 commit 02a2fd1

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/xmlcli/XmlCliLib.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -792,12 +792,13 @@ def ConfXmlCli(SkipEnable=0):
792792
try:
793793
from .tools.restricted import EnableXmlCli as exc
794794
except (ModuleNotFoundError, ImportError) as e:
795-
from .tools import EnableXmlCli as exc
796-
except ImportError:
797-
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
798-
CloseInterface()
799-
LastErrorSig = 0x13E4 # import error
800-
return 0xF
795+
try:
796+
from .tools import EnableXmlCli as exc
797+
except ImportError:
798+
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
799+
CloseInterface()
800+
LastErrorSig = 0x13E4 # import error
801+
return 0xF
801802
Status = exc.EnableXmlCli()
802803
if Status == 0:
803804
Status = 2
@@ -824,11 +825,12 @@ def TriggerXmlCliEntry():
824825
try:
825826
from .tools.restricted import EnableXmlCli as exc
826827
except (ModuleNotFoundError, ImportError) as e:
827-
from .tools import EnableXmlCli as exc
828-
except ImportError:
829-
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
830-
LastErrorSig = 0x13E4 # import error
831-
return 1
828+
try:
829+
from .tools import EnableXmlCli as exc
830+
except ImportError:
831+
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
832+
LastErrorSig = 0x13E4 # import error
833+
return 1
832834
status = exc.XmlCliApiAuthenticate()
833835
if status:
834836
LastErrorSig = 0xE7CA # Error Triggering XmlCli command, Authentication Failed

0 commit comments

Comments
 (0)