changeset 3:aa5c088856c8 draft

planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/erecord-deploy/-/tree/main/galaxy-tools/erecord_file commit 490623122691651ac91c33d75ea1898189be7512-dirty
author siwaa
date Thu, 15 Feb 2024 15:24:53 +0000
parents 9e8f5f220917
children 4c45f7b92955
files main_file.py
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/main_file.py	Thu Feb 15 14:44:47 2024 +0000
+++ b/main_file.py	Thu Feb 15 15:24:53 2024 +0000
@@ -58,6 +58,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()
 
@@ -110,9 +114,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)
@@ -155,8 +157,12 @@
 
 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 --")