Create the data directory before writing the sheet
SheetFetcher.save() opened paths.sheet_html without creating its parent, so a fresh install failed with FileNotFoundError on the first fetch -- Paths only computes locations, and this is usually the first write to the data root. Matches how every other writer in the pipeline behaves.
This commit is contained in:
@@ -51,6 +51,7 @@ class SheetFetcher:
|
|||||||
def save(self, content=None):
|
def save(self, content=None):
|
||||||
"""Write the tab's HTML, returning where it landed."""
|
"""Write the tab's HTML, returning where it landed."""
|
||||||
content = self.fetch() if content is None else content
|
content = self.fetch() if content is None else content
|
||||||
|
os.makedirs(os.path.dirname(self.paths.sheet_html), exist_ok=True)
|
||||||
with open(self.paths.sheet_html, "wb") as handle:
|
with open(self.paths.sheet_html, "wb") as handle:
|
||||||
handle.write(content)
|
handle.write(content)
|
||||||
return self.paths.sheet_html
|
return self.paths.sheet_html
|
||||||
|
|||||||
Reference in New Issue
Block a user