@@ -64,7 +64,7 @@ class pythonProgramOptions:
6464 # if COMPAS_INPUT_DIR_PATH is not set (== None) the current working directory
6565 # is prepended to input filenames
6666 compas_input_path_override = os .environ .get ('COMPAS_INPUT_DIR_PATH' )
67-
67+
6868 #-- option to make a grid of hyperparameter values at which to produce populations.
6969 #-- If this is set to true, it will divide the number_of_binaries parameter equally
7070 #-- amoungst the grid points (as closely as possible). See the hyperparameterGrid method below
@@ -80,17 +80,17 @@ class pythonProgramOptions:
8080
8181 if grid_filename != None :
8282 if compas_input_path_override == None :
83- grid_filename = os .getcwd () + '/' + grid_filename
83+ grid_filename = os .getcwd () + '/' + grid_filename . strip ( "' \" " )
8484 else :
85- grid_filename = compas_input_path_override + '/' + grid_filename
85+ grid_filename = compas_input_path_override + '/' + grid_filename . strip ( "' \" " )
8686
8787 logfile_definitions = None # logfile record definitions file name (e.g. 'logdefs.txt')
8888
8989 if logfile_definitions != None :
9090 if compas_input_path_override == None :
91- logfile_definitions = os .getcwd () + '/' + logfile_definitions
91+ logfile_definitions = os .getcwd () + '/' + logfile_definitions . strip ( "' \" " )
9292 else :
93- logfile_definitions = compas_input_path_override + '/' + logfile_definitions
93+ logfile_definitions = compas_input_path_override + '/' + logfile_definitions . strip ( "' \" " )
9494
9595 initial_mass = None # initial mass for SSE
9696 initial_mass_1 = None # primary initial mass for BSE
@@ -727,9 +727,15 @@ def combineCommandLineOptionsDictIntoShellCommand(commandOptions):
727727
728728
729729def cleanStringParameter (str_param ):
730- """ strip quotes and escape spaces to avoid confusing Boost """
730+ """ clean up string parameters to avoid confusing Boost """
731731 if str_param is not None :
732- str_param = re .sub (r"(?<!\\) " , r"\ " , str_param ).replace ("'" , "" ).replace ('"' , '' )
732+ # strip any quotes from the ends of the string
733+ str_param = str_param .strip ("'\" " )
734+
735+ # escape any unescaped spaces or quotes within the string
736+ escapes = [" " , "'" , "\" " ]
737+ for escape in escapes :
738+ str_param = re .sub (r"(?<!\\){}" .format (escape ), r"\{}" .format (escape ), str_param )
733739 return str_param
734740
735741
0 commit comments