From 88a272453a3d2993a925710eb090e17fed8dc3a3 Mon Sep 17 00:00:00 2001 From: William Grochocinski Date: Wed, 15 Jan 2025 15:00:54 -0500 Subject: [PATCH 1/3] removed ANSI codes from Ruby error messages --- simopt/gui/new_experiment_window.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simopt/gui/new_experiment_window.py b/simopt/gui/new_experiment_window.py index e6c484f20..0919c438e 100644 --- a/simopt/gui/new_experiment_window.py +++ b/simopt/gui/new_experiment_window.py @@ -1911,9 +1911,11 @@ def __create_design_core(self, base_object: str) -> None: ) except Exception as e: + # Strip all ANSI codes from the error message + error_msg = re.sub(r"\x1b\[[0-?]*[ -/]*[@-~]", "", str(e)) messagebox.showerror( "Error", - f"An error occurred while creating the design: {e}", + f"An error occurred while creating the design: {error_msg}", ) return From 4a1573f3952a934658bcdcf911c8ea176828de3b Mon Sep 17 00:00:00 2001 From: William Grochocinski Date: Tue, 21 Jan 2025 20:37:42 -0500 Subject: [PATCH 2/3] Added handling for spaces in Ruby file/dest paths --- simopt/experiment_base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/simopt/experiment_base.py b/simopt/experiment_base.py index 5819ece06..db9531b1c 100644 --- a/simopt/experiment_base.py +++ b/simopt/experiment_base.py @@ -6745,6 +6745,9 @@ def create_design( design_file = os.path.join( data_farming_path, f"{factor_settings_filename}_design.txt" ) + # Add apostrophes to the paths to avoid issues with spaces in the path + source_file = f'"{source_file}"' + design_file = f'"{design_file}"' # If the dest file already exists, delete it # TODO: investigate if this may cause issues with multiple concurrent designs if os.path.exists(design_file): From 52b5cb9dfdf48e3d926aad5d90986b14154b48e1 Mon Sep 17 00:00:00 2001 From: William Grochocinski Date: Tue, 21 Jan 2025 21:20:53 -0500 Subject: [PATCH 3/3] fixed Ruby script status check not working correctly --- simopt/experiment_base.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/simopt/experiment_base.py b/simopt/experiment_base.py index db9531b1c..6f4ff4e47 100644 --- a/simopt/experiment_base.py +++ b/simopt/experiment_base.py @@ -2860,9 +2860,9 @@ def check_common_problem_and_reference( problem_list = [experiment.problem for experiment in experiments] problem_err_msg = "All experiments must have the same problem." - assert all( - elem == problem_list[0] for elem in problem_list - ), problem_err_msg + assert all(elem == problem_list[0] for elem in problem_list), ( + problem_err_msg + ) x0_list = [experiment.x0 for experiment in experiments] x0_err_msg = "All experiments must have the same starting solution." @@ -6745,9 +6745,6 @@ def create_design( design_file = os.path.join( data_farming_path, f"{factor_settings_filename}_design.txt" ) - # Add apostrophes to the paths to avoid issues with spaces in the path - source_file = f'"{source_file}"' - design_file = f'"{design_file}"' # If the dest file already exists, delete it # TODO: investigate if this may cause issues with multiple concurrent designs if os.path.exists(design_file): @@ -6776,12 +6773,10 @@ def create_design( # Replace backslashes with forward slashes source_file_wsl = source_file_wsl.replace("\\", "/") design_file_wsl = design_file_wsl.replace("\\", "/") - command = f"{command_file} -s {n_stacks} {source_file_wsl} > {design_file_wsl}" + command = f"{command_file} -s {n_stacks} '{source_file_wsl}' > '{design_file_wsl}'" command = f'wsl -e bash -lic "{command}"' else: - command = ( - f"{command_file} -s {n_stacks} {source_file} > {design_file}" - ) + command = f"{command_file} -s {n_stacks} '{source_file}' > '{design_file}'" completed_process = subprocess.run( command, capture_output=True, shell=True )