From c470a07458cdf1e695836e48efc4b5d4d1e32c59 Mon Sep 17 00:00:00 2001 From: Peter Mosmans Date: Fri, 16 Sep 2016 10:20:01 +1000 Subject: [PATCH] Show nice error message when importing lxml fails --- chatops/python/validate_report.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chatops/python/validate_report.py b/chatops/python/validate_report.py index a0ec428..fe9ae61 100644 --- a/chatops/python/validate_report.py +++ b/chatops/python/validate_report.py @@ -31,7 +31,13 @@ import sys import textwrap import xml.sax -from lxml import etree as ElementTree +try: + from lxml import etree as ElementTree +except ImportError as exception: + print('[-] This script needs lxml', + file=sys.stderr) + print("Install lxml with: sudo pip install lxml", file=sys.stderr) + sys.exit(-1) # When set to True, the report will be validated using docbuilder