From 8eba6d881a64ad9e2a8aceed31d00d961ef67441 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 12 Nov 2024 17:05:38 -0700 Subject: [PATCH] ignore same file errors --- CIME/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CIME/utils.py b/CIME/utils.py index 59cbf3c7666..ede4bdb42ca 100644 --- a/CIME/utils.py +++ b/CIME/utils.py @@ -1409,10 +1409,14 @@ def safe_copy(src_path, tgt_path, preserve_meta=True): if owner_uid == os.getuid(): # I am the owner, copy file contents, permissions, and metadata - shutil.copy2( - src_path, - tgt_path, - ) + try: + shutil.copy2( + src_path, + tgt_path, + ) + # ignore same file error + except shutil.SameFileError: + pass else: # I am not the owner, just copy file contents shutil.copyfile(src_path, tgt_path)