From 1cb2f61e171144e60be54654304a730171c3e671 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 17 Jun 2024 03:29:11 -0500 Subject: [PATCH] fix: Allow for shutil.copytree to have existing dirs * Add dirs_exist_ok=True to allow the copying operation to continue if it encounters existing directories. - c.f. https://docs.python.org/3.12/library/shutil.html#shutil.copytree - dirs_exist_ok was added in Python 3.8. * Amends PR 155. --- src/recastatlas/subcommands/catalogue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recastatlas/subcommands/catalogue.py b/src/recastatlas/subcommands/catalogue.py index 991282a..f35882f 100644 --- a/src/recastatlas/subcommands/catalogue.py +++ b/src/recastatlas/subcommands/catalogue.py @@ -45,7 +45,7 @@ def check(name): @click.argument("path") def create(name, path): template_path = files("recastatlas") / "data/templates/helloworld" - shutil.copytree(template_path, path) + shutil.copytree(template_path, path, dirs_exist_ok=True) recast_file = os.path.join(path, "recast.yml") data = string.Template(open(recast_file).read()).safe_substitute( name=name, author=getpass.getuser()