|
1 | 1 | import numpy as np |
2 | | -import subprocess |
3 | 2 | import sys |
4 | 3 | import os |
5 | | -import pickle |
6 | | -import itertools |
7 | 4 | from subprocess import call |
| 5 | +import re |
8 | 6 |
|
9 | 7 | # Check if we are using python 3 |
10 | 8 | python_version = sys.version_info[0] |
@@ -94,14 +92,6 @@ class pythonProgramOptions: |
94 | 92 | else: |
95 | 93 | logfile_definitions = compas_input_path_override + '/' + logfile_definitions |
96 | 94 |
|
97 | | - # ensure that no file paths have spaces that could confuse Boost |
98 | | - for path in [output, grid_filename, logfile_definitions]: |
99 | | - if path is not None and path.find(" ") >= 0: |
100 | | - print("ERROR: File path contains spaces, replace with underscores or another character.") |
101 | | - print("\t" + path) |
102 | | - print("\t" + " " * path.find(" ") + "^") |
103 | | - exit(1) |
104 | | - |
105 | 95 | initial_mass = None # initial mass for SSE |
106 | 96 | initial_mass_1 = None # primary initial mass for BSE |
107 | 97 | initial_mass_2 = None # secondary initial mass for BSE |
@@ -309,6 +299,16 @@ class pythonProgramOptions: |
309 | 299 | debug_to_file = False |
310 | 300 | errors_to_file = False |
311 | 301 |
|
| 302 | + # ensure that no file paths have unescaped spaces that could confuse Boost |
| 303 | + paths = [output, grid_filename, logfile_definitions, logfile_common_envelopes, logfile_detailed_output, |
| 304 | + logfile_double_compact_objects, logfile_rlof_parameters, logfile_pulsar_evolution, |
| 305 | + logfile_supernovae, logfile_switch_log, logfile_system_parameters] |
| 306 | + for i in range(len(paths)): |
| 307 | + if paths[i] is not None: |
| 308 | + paths[i] = re.sub(r"(?<!\\) ", r"\ ", paths[i]) |
| 309 | + output, grid_filename, logfile_definitions, logfile_common_envelopes, logfile_detailed_output,\ |
| 310 | + logfile_double_compact_objects, logfile_rlof_parameters, logfile_pulsar_evolution,\ |
| 311 | + logfile_supernovae, logfile_switch_log, logfile_system_parameters = paths |
312 | 312 |
|
313 | 313 | def booleanChoices(self): |
314 | 314 | booleanChoices = [ |
|
0 commit comments