From 5d2e86c0d0b8afdd5ffd8b9c84d2283294e0ad3a Mon Sep 17 00:00:00 2001 From: mhoeschle <mhoeschle> Date: Fri, 24 Nov 2023 15:27:33 +0100 Subject: [PATCH] delete opening updated toml after updating. --- toml_handling.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/toml_handling.py b/toml_handling.py index c6b408e..7d1f224 100644 --- a/toml_handling.py +++ b/toml_handling.py @@ -76,21 +76,16 @@ def access_toml_file(cam_serial_swig_adress): # for parameter in data.items(): # print(f'Parameter_after_updating: {parameter}') + # change data to update befor uploading to the file + cam_data_update = data + # # Write to modified config: # + # move to the end with open(config_filename, "w") as f: toml.dump(data, f) - # - # open toml file to use updated camera input and SWIG: - # - with open(config_filename, "rb") as f: - cam_data_update = tomllib.load(f) - - for new_parameter in cam_data_update.items(): - print(f'Updated_Parameter: {new_parameter}') # for debug - return cam_data_update # access_toml_file(cam_serial_swig_adress) @@ -101,3 +96,5 @@ def access_toml_file(cam_serial_swig_adress): # test2 = list(cam_data_update.get('connected_cameras').keys())[0] # print(f'Camera_ID_Updated: {test2}') + +# split into two files one read and other write -- GitLab