#! /usr/bin/python # # json_update.py # # Jan/15/2025 # # ------------------------------------------------------------------- import sys import os import json # sys.path.append('/var/www/data_base/common/python_common') from text_manipulate import dict_update_proc # ------------------------------------------------------------------- sys.stderr.write("*** 開始 ***\n") # file_json = sys.argv[1] key_in = sys.argv[2] population_in = int(sys.argv[3]) # print(file_json) print("%s\t%d" % (key_in, population_in)) # if os.path.exists(file_json): dict_aa = {} with open(file_json) as ff: dict_aa = json.load(ff) dict_bb = dict_update_proc(dict_aa,key_in,population_in) with open(file_json, 'w') as ff: json.dump(dict_bb,ff) else: sys.stderr.write("*** error *** %s doesn't exist ***\n" % file_json) # sys.stderr.write("*** 終了 ***\n") # -------------------------------------------------------------------