From f215ff57dc265899b1f26455e34730a51d0140ae Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 26 Aug 2024 09:00:55 -0500 Subject: [PATCH] correcting path construction --- src/acom_music_box/evolving_conditions.py | 10 +++++----- src/acom_music_box/main.py | 3 ++- src/acom_music_box/reaction_list.py | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/acom_music_box/evolving_conditions.py b/src/acom_music_box/evolving_conditions.py index 589f4337..eaa8ded7 100644 --- a/src/acom_music_box/evolving_conditions.py +++ b/src/acom_music_box/evolving_conditions.py @@ -129,11 +129,11 @@ def from_config_JSON( if 'evolving conditions' in config_JSON: if len(config_JSON['evolving conditions'].keys()) > 0: # Construct the path to the evolving conditions file - evolving_conditions_path = ( - os.path.dirname(path_to_json) + - "/" + - list( - config_JSON['evolving conditions'].keys())[0]) + + evolving_conditions_path = os.path.join( + os.path.dirname(path_to_json), + list(config_JSON['evolving conditions'].keys())[0]) + evolving_conditions = EvolvingConditions.read_conditions_from_file( evolving_conditions_path, species_list, reaction_list) diff --git a/src/acom_music_box/main.py b/src/acom_music_box/main.py index b6dd522f..d3f1c01c 100644 --- a/src/acom_music_box/main.py +++ b/src/acom_music_box/main.py @@ -76,6 +76,7 @@ def main(): # create and load a MusicBox object myBox = MusicBox() + logging.info("configuration file = {}".format(musicBoxConfigFile)) myBox.readConditionsFromJson(musicBoxConfigFile) logger.info("myBox = {}".format(myBox)) @@ -87,7 +88,7 @@ def main(): myBox.create_solver(campConfig) logger.info("myBox.solver = {}".format(myBox.solver)) mySolution = myBox.solve(os.path.join(musicBoxOutputDir, "mySolution.csv")) - logger.info("mySolution = {}".format(mySolution)) + # logger.info("mySolution = {}".format(mySolution)) logger.info("End time: {}".format(datetime.datetime.now())) sys.exit(0) diff --git a/src/acom_music_box/reaction_list.py b/src/acom_music_box/reaction_list.py index 247e279a..a7592caf 100644 --- a/src/acom_music_box/reaction_list.py +++ b/src/acom_music_box/reaction_list.py @@ -71,8 +71,9 @@ def from_config_JSON(cls, path_to_json, config_JSON, species_list): list_name = None # gets config file path - config_file_path = os.path.dirname( - path_to_json) + "/" + config_JSON['model components'][0]['configuration file'] + config_file_path = os.path.join( + os.path.dirname(path_to_json), + config_JSON['model components'][0]['configuration file']) # opnens config path to read reaction file with open(config_file_path, 'r') as json_file: