Skip to content

Commit

Permalink
added setup_directories to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPlayer3 committed Feb 28, 2024
1 parent 5308f75 commit 4543ee9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/asf_tools/watermasking/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,15 @@ def remove_temp_files(temp_files: list):
for file in temp_files:
try:
os.remove(file)
except:
print('Error removing temporary file. Skipping it...')
except Exception as e:
print(f'Caught {e} while removing temporary file: {file}. Skipping it...')


def setup_directories(dirs: list[str]):
"""Setup the directories necessary for running the script."""
for dir in dirs:
try:
os.mkdir(dir)
except FileExistsError as e:
# Directories already exists.
pass

0 comments on commit 4543ee9

Please sign in to comment.