From ad47684e7e19819fd9f6aadad4e4c1dff91b5db2 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 15 Sep 2021 07:52:05 +0200 Subject: [PATCH] Port the example to Python 3 Cannot keep Python 2 compatibility because of exception handling: Python 2: except jsonparser.JSONException, e: Python 3: except jsonparser.JSONException as e: --- bindings/python/example/test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/python/example/test.py b/bindings/python/example/test.py index 2307a042..29338fa1 100644 --- a/bindings/python/example/test.py +++ b/bindings/python/example/test.py @@ -3,9 +3,9 @@ import jsonparser -data = open('test.json', 'rb').read() +data = open('test.json', 'r').read() try: output = jsonparser.decode(data) - print output -except jsonparser.JSONException, e: - print 'Error -> %s' % e + print(output) +except jsonparser.JSONException as e: + print('Error -> %s' % e)