Skip to content

Commit

Permalink
Ignore error if directory already exists (#47)
Browse files Browse the repository at this point in the history
* Ignore error if directory already exists

Fixes #46

* issues/46: Ignore errors if destination directory already exists.

Co-authored-by: Frank Greguska <Francis.Greguska@jpl.nasa.gov>
  • Loading branch information
frankinspace and Frank Greguska authored Feb 24, 2022
1 parent 59c358a commit 4e2f967
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ data-sub/
build/
dist/
podaac_data_subscriber.egg-info/
.idea/
.idea/
venv
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Changed
- created library of common access mechanisms to split between subscriber and downloader capabilities
- added .tar.gz to list of default extensions. [40](https://github.com/podaac/data-subscriber/issues/40)
- Ignore error if destination directory already exists. [46](https://github.com/podaac/data-subscriber/issues/46)
### Deprecated
### Removed
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion subscriber/podaac_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def validate(args):

def check_dir(path):
if not isdir(path):
makedirs(path)
makedirs(path, exist_ok=True)


def prepare_time_output(times, prefix, file, args, ts_shift):
Expand Down
2 changes: 1 addition & 1 deletion subscriber/podaac_data_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def run():

if not isdir(data_path):
print("NOTE: Making new data directory at " + data_path + "(This is the first run.)")
makedirs(data_path)
makedirs(data_path, exist_ok=True)

# Change this to whatever extent you need. Format is W Longitude,S Latitude,E Longitude,N Latitude
bounding_extent = args.bbox
Expand Down
2 changes: 1 addition & 1 deletion subscriber/podaac_data_subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def run():

if not isdir(data_path):
print("NOTE: Making new data directory at " + data_path + "(This is the first run.)")
makedirs(data_path)
makedirs(data_path, exist_ok=True)
else:
try:
with open(data_path + "/.update", "r") as f:
Expand Down

0 comments on commit 4e2f967

Please sign in to comment.