Commit 27e51545b3051fd590a035d0c8fe6e3b2f644a5d

Authored by Alexis Koralewski
1 parent 6d6e8325
Exists in dev

fix plc_checker saving plc_config.json path issue

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
src/core/pyros_django/env_monitor/plc_checker.py
@@ -154,11 +154,11 @@ class PlcChecker(object): @@ -154,11 +154,11 @@ class PlcChecker(object):
154 # When executing test, we're not in the monitoring folder 154 # When executing test, we're not in the monitoring folder
155 if("pyros_django" == os.getcwd().split("/")[-1]): 155 if("pyros_django" == os.getcwd().split("/")[-1]):
156 plc_config_dir = Path("./env_monitor/") 156 plc_config_dir = Path("./env_monitor/")
157 - _file = open(plc_config_dir/"plc_config.json" , 'w') 157 + _file = open(os.path.join(plc_config_dir,"plc_config.json") , 'w')
158 _file.write(json.dumps(_struct)) 158 _file.write(json.dumps(_struct))
159 _file.close() 159 _file.close()
160 logger.info("Saved : plc_config.json") 160 logger.info("Saved : plc_config.json")
161 - except: 161 + except Exception as :
162 logger.error("Not saved plc_config.json") 162 logger.error("Not saved plc_config.json")
163 raise Exception(f"Could not save plc_config.json ; current dir is {os.getcwd()} ; plc_config_dir is {plc_config_dir}") 163 raise Exception(f"Could not save plc_config.json ; current dir is {os.getcwd()} ; plc_config_dir is {plc_config_dir}")
164 164