File indexing completed on 2024-04-21 14:43:51
0001 #!/usr/bin/python 0002 # 0003 # GCompris - validate-json.py 0004 # 0005 # SPDX-FileCopyrightText: 2015 Bruno Coudoin <bruno.coudoin@gcompris.net> 0006 # 0007 # SPDX-License-Identifier: GPL-3.0-or-later 0008 import json 0009 import sys 0010 0011 if len(sys.argv) != 2: 0012 print("Usage: validate-json.py json_file") 0013 sys.exit(1) 0014 0015 inf=sys.argv[1] 0016 0017 with open(inf) as data_file: 0018 try: 0019 data = json.load(data_file) 0020 print("Processing OK " + inf) 0021 except ValueError as e: 0022 print(dir(e)) 0023 print("Processing KO " + inf) 0024 print("Parser error: {0}".format(e.message)) 0025