Skip to content

Commit 036ec7d

Browse files
ElienVandermaesenVITOsoxofaan
authored andcommitted
issue #689 create directory in connection.download if it doesn't exist
1 parent 84c073c commit 036ec7d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

openeo/rest/connection.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
ContextTimer,
8484
LazyLoadCache,
8585
dict_no_none,
86+
ensure_dir,
8687
ensure_list,
8788
load_json_resource,
8889
repr_truncate,
@@ -1748,7 +1749,9 @@ def download(
17481749
)
17491750

17501751
if outputfile is not None:
1751-
with Path(outputfile).open(mode="wb") as f:
1752+
target = Path(outputfile)
1753+
ensure_dir(target.parent)
1754+
with target.open(mode="wb") as f:
17521755
for chunk in response.iter_content(chunk_size=chunk_size):
17531756
f.write(chunk)
17541757
else:

0 commit comments

Comments
 (0)