Skip to content

Commit

Permalink
Don't complain if target directory exists, but empty
Browse files Browse the repository at this point in the history
Since the last commit already creates the directory (to make sure
copying the HDF5 file works), shutil.copytree bailed without the
`dirs_exist_ok` flag.  If the directory is not empty we raise an error
though.
  • Loading branch information
pmrv committed Oct 19, 2021
1 parent 03019bd commit 6958878
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyiron_base/job/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,12 @@ def _internal_copy_to(self, project=None, new_job_name=None, new_database_entry=

# Copy files outside the HDF5 file
if copy_files and os.path.exists(self.working_directory):
if len(os.listdir(self.working_directory)) > 0:
raise RuntimeError("Target directory for copy not empty!")
shutil.copytree(
self.working_directory,
new_job_core.working_directory,
dirs_exist_ok=True
)
return new_job_core, file_project, hdf5_project, False

Expand Down

0 comments on commit 6958878

Please sign in to comment.