Skip to content

Commit

Permalink
FIX: Ensure directories exist before downloading datafile from URL
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Dec 5, 2023
1 parent 2c62aab commit 6c523ff
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions octue/resources/datafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ def download(self, local_path=None):

# Download from a URL.
if storage.path.is_url(self.cloud_path):
local_path_directory = os.path.dirname(self._local_path)
os.makedirs(local_path_directory, exist_ok=True)

with open(self._local_path, "wb") as f:
f.write(requests.get(self.cloud_path).content)

Expand Down

0 comments on commit 6c523ff

Please sign in to comment.