Skip to content

Commit

Permalink
Create any missing directories in output path
Browse files Browse the repository at this point in the history
  • Loading branch information
renaudguerin committed Aug 20, 2023
1 parent 8d5080d commit 609a978
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/greaseweazle/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Image:
## Context manager for image objects created using .to_file()

def __enter__(self):
os.makedirs(os.path.dirname(self.filename), exist_ok=True)
self.file = open(self.filename, ('wb','xb')[self.noclobber])
return self

Expand Down

0 comments on commit 609a978

Please sign in to comment.