# HG changeset patch # User siwaa # Date 1708010681 0 # Node ID eb06af7c29a8f1e9d5f4f211524776c198a293da # Parent afc88ac8de690dc8bd631e2640be3356bc16f545 planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/erecord-deploy/-/tree/main/galaxy-tools/erecord_json commit 490623122691651ac91c33d75ea1898189be7512-dirty diff -r afc88ac8de69 -r eb06af7c29a8 main_json.py --- a/main_json.py Thu Feb 15 14:44:16 2024 +0000 +++ b/main_json.py Thu Feb 15 15:24:41 2024 +0000 @@ -24,7 +24,6 @@ Outputs : - output.json data file (jsonoutput_filepath) - """ MAIN_DEBUG=False # True for more information returned @@ -50,6 +49,10 @@ data = dict() json_response = dict() +# default configuration + maybe some modifications +config = erecord_api.conf() # default (vle-2.0.0 version) +config.DB_add_vpz(vpz_id=1312, vpzname="wwdm.vpz", pkgname="wwdm") + try : parser = argparse.ArgumentParser() parser.add_argument("-data", type=str, help="data json file path") @@ -81,9 +84,7 @@ r["data"] = data - # default configuration + maybe some modifications - config = erecord_api.conf() # default (vle-2.0.0 version) - config.DB_add_vpz(vpz_id=1312, vpzname="wwdm.vpz", pkgname="wwdm") + # configuration if MAIN_DEBUG: r["config"] = config.get_as_dict() # debug r_init = erecord_api.init(config) @@ -99,8 +100,13 @@ r["response"] = json_response -# Restitution : json file -jsonoutput_filepath = os.path.join(config.out_path, config.jsonoutput_filename) -with open(jsonoutput_filepath, "w") as outfile: - json.dump(r, outfile) +try : + # Restitution : json file + jsonoutput_filepath = os.path.join(config.out_path, + config.jsonoutput_filename) + with open(jsonoutput_filepath, "w") as outfile: + json.dump(r, outfile) +except : + print(PM, " -- error when trying to open output json file --") +