Skip to content

Commit

Permalink
Fix bug in windows file path (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFP committed Sep 15, 2023
1 parent 911b650 commit f3ef94d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libensemble/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,12 @@ def _kill_workers(self) -> None:
def _save_every_k(self, fname: str, count: int, k: int) -> None:
"""Saves history every kth step"""
count = k * (count // k)
filename = fname.format(self.date_start, count)
date_start = self.date_start
if platform.system() == "Windows":
filename = filename.replace(":", "-") # ":" is invalid in windows filenames
date_start = date_start.replace(":", "-") # ":" is invalid in windows filenames
filename = fname.format(date_start, count)
if not os.path.isfile(filename) and count > 0:
for old_file in glob.glob(fname.format(self.date_start, "*")):
for old_file in glob.glob(fname.format(date_start, "*")):
os.remove(old_file)
np.save(filename, self.hist.H)

Expand Down

0 comments on commit f3ef94d

Please sign in to comment.