Skip to content

Commit 5bf2900

Browse files
authored
Update sho-ver.py
use function syntax for print so script is more easily migrated to newer Python versions
1 parent 9ea3c2e commit 5bf2900

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Py-sho-ver-onbox/sho-ver.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@
3030
#!/usr/bin/python
3131

3232
import cli
33-
print cli.execute('show version')
33+
import sys
34+
35+
try:
36+
print(cli.execute('show version'))
37+
except Exception as err:
38+
sys.stderr.write("CLI error: {0}\n".format(err))
39+
sys.exit(1)

0 commit comments

Comments
 (0)