Skip to content

Commit

Permalink
Add check if the file that is being retrieved on a directory changer
Browse files Browse the repository at this point in the history
exists and skip the copy if it does not exist. This is useful in instances
where optional files are requested when executing a physics code and
not all files are created because the user settings differ than the
default behavior.
  • Loading branch information
jakehader committed Apr 22, 2022
1 parent 7d9ef5f commit d522ed0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions armi/utils/directoryChangers.py
Expand Up @@ -187,6 +187,10 @@ def _transferFiles(initialPath, destinationPath, fileList):

for fromName, destName in copies:
fromPath = os.path.join(initialPath, fromName)
if not os.path.exists(fromPath):
runLog.warning(f"{fromPath} does not exist and will not be copied.")
continue

toPath = os.path.join(destinationPath, destName)
runLog.extra("Copying {} to {}".format(fromPath, toPath))
shutil.copy(fromPath, toPath)
Expand Down

0 comments on commit d522ed0

Please sign in to comment.