Skip to content

Commit

Permalink
exception added to simple_transfer.py if folder is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
robban80 committed Oct 7, 2024
1 parent 9d81355 commit eeb923c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/simple_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ def do_transfer(source_path, new_cell_path):
# create output dir (check for existance is done in prev stage)
os.makedirs(new_cell_path)

if os.path.isfile(f'{source_path}/val_models.json'):
files_in_folder = [f for f in os.listdir(source_path) if os.path.isfile(os.path.join(source_path, f))]
if not len(files_in_folder):
raise Exception('\n\nInput Error - the source directory is empty\n'
f'{source_path}\n'
'Possibly the files are in a subdirectory of the source?')
elif os.path.isfile(f'{source_path}/val_models.json'):
opt_res = f'{source_path}/hall_of_fame.json'
select = f'{source_path}/val_models.json'
f = 'val_models.json'
Expand Down

0 comments on commit eeb923c

Please sign in to comment.