Skip to content

Commit f7476ab

Browse files
Solve cams download shutil rmtree issue
1 parent 0203541 commit f7476ab

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

providentia/cams.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ def download_cams_experiment(self, experiment):
444444
temp_dir = join(self.download_instance.exp_to_interp_root,'.temp', dir_tail)
445445
final_dir = join(self.download_instance.exp_to_interp_root, dir_tail)
446446

447-
# create temporal and final dirs to store the middle zip file with its directories
448-
os.makedirs(temp_dir, exist_ok=True)
447+
# create dir
449448
os.makedirs(final_dir, exist_ok=True)
450449

451450
# create client
@@ -472,6 +471,9 @@ def download_cams_experiment(self, experiment):
472471
# get final path
473472
file_name = f"{species}_{current_cams_date.strftime(date_format)}.nc"
474473
final_path = join(final_dir, file_name)
474+
475+
# create temporal dir to store the middle zip file with its directories
476+
os.makedirs(temp_dir, exist_ok=True)
475477

476478
# get temporal path
477479
temp_path = join(temp_dir, 'zip_file')
@@ -523,4 +525,4 @@ def download_cams_experiment(self, experiment):
523525
current_cams_date = next_cams_date + timedelta(days=1)
524526

525527
# remove the temp directory tail
526-
shutil.rmtree(join(self.download_instance.exp_to_interp_root,'.temp'))
528+
shutil.rmtree(temp_dir)

0 commit comments

Comments
 (0)