From ff1044a401512ecffe0869b340253da4c41801ee Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sun, 22 Sep 2019 23:31:15 -0700 Subject: [PATCH] Fixed logic error in non_clobber_path() * Before the '_1000' path would be returned incorrectly * If a non-existant path wasn't found that is --- scripts/wk/io.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/wk/io.py b/scripts/wk/io.py index cba8b3fa..d7841fda 100644 --- a/scripts/wk/io.py +++ b/scripts/wk/io.py @@ -78,8 +78,9 @@ def non_clobber_path(path): # Find non-existant path for _i in range(1000): - new_path = path.with_name(f'{name}_{_i}').with_suffix(suffix) - if not new_path.exists(): + test_path = path.with_name(f'{name}_{_i}').with_suffix(suffix) + if not test_path.exists(): + new_path = test_path break # Raise error if viable path not found