Skip to content

Commit

Permalink
Merge pull request #428 from stephenpcook/str-3.8-compatible
Browse files Browse the repository at this point in the history
Refactor to avoid str.removeprefix
  • Loading branch information
jshipton authored Aug 24, 2023
2 parents c12afac + 88ecedd commit 543d67f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gusto/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ def update_logfile_location(new_path, comm):
fh = fh[0]
logger.debug("Closing temporary logger and moving logfile")
old_path = Path(fh.baseFilename)
filename = Path(old_path.name.removeprefix("temp-"))
# str.removeprefix unavailable for python version <3.9
filename_str = old_path.name
if filename_str.startswith("temp-"):
filename_str = filename_str[5:]
filename = Path(filename_str)
fh.flush()
fh.close()
logger.removeHandler(fh)
Expand Down

0 comments on commit 543d67f

Please sign in to comment.