Blob Blame History Raw
From 59f7e0b123fc9789538f610a89d350d76c35106b Mon Sep 17 00:00:00 2001
From: Jakub Heger <jheger@redhat.com>
Date: Wed, 22 Aug 2018 12:37:49 +0200
Subject: [PATCH 2/4] journalling: try import

imports are now in try block, exceptions cause unsuccessful exit with
error message printed
---
 src/python/journalling.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/python/journalling.py b/src/python/journalling.py
index 220d5d2..7a65d78 100755
--- a/src/python/journalling.py
+++ b/src/python/journalling.py
@@ -23,14 +23,18 @@
 # TODO fix xml pretty print


-import os
-import re
-import sys
-import six
-import time
-import base64
-from lxml import etree
-from optparse import OptionParser
+try:
+    import os
+    import re
+    import sys
+    import six
+    import time
+    import base64
+    from lxml import etree
+    from optparse import OptionParser
+except ImportError as e:
+    sys.stderr.write("Python ImportError: " + str(e) + "\nExiting unsuccessfully.\n")
+    exit(1)


 xmlForbidden = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, 19, 20,
--
2.17.1