summaryrefslogtreecommitdiff
path: root/examples/py-schema-validation
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-04-09 12:10:19 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-04-09 14:12:48 +0200
commit4e583cd4dedd6467f300eea5947a4f6bb2c036f2 (patch)
treedae818feb42faa54a1c2e68f0bb8d35f7ee92d13 /examples/py-schema-validation
parent0a7ad7a76ac34d7a0c7635591203de08979b60da (diff)
Added JSON schema validation to run_tests.sh
* Python3 scripts are now compatible with versions <3.6 * improved and prettified run_tests.sh Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/py-schema-validation')
-rwxr-xr-xexamples/py-schema-validation/py-schema-validation.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/py-schema-validation/py-schema-validation.py b/examples/py-schema-validation/py-schema-validation.py
index 583612516..e8fc390f1 100755
--- a/examples/py-schema-validation/py-schema-validation.py
+++ b/examples/py-schema-validation/py-schema-validation.py
@@ -7,7 +7,7 @@ sys.path.append(os.path.dirname(sys.argv[0]) + '/../usr/share/nDPId')
try:
import nDPIsrvd
from nDPIsrvd import nDPIsrvdSocket, TermColor
-except ModuleNotFoundError:
+except ImportError:
sys.path.append(os.path.dirname(sys.argv[0]) + '/../../dependencies')
import nDPIsrvd
from nDPIsrvd import nDPIsrvdSocket, TermColor
@@ -43,4 +43,7 @@ if __name__ == '__main__':
nsock = nDPIsrvdSocket()
nsock.connect(address)
- nsock.loop(onJsonLineRecvd, Stats())
+ try:
+ nsock.loop(onJsonLineRecvd, Stats())
+ except nDPIsrvd.SocketConnectionBroken as err:
+ sys.stderr.write('\n{}\n'.format(err))