From 644fab1f5ed35a5bffb103af66c083f10f0f9d18 Mon Sep 17 00:00:00 2001 From: canh Date: Thu, 21 Apr 2022 18:23:41 +0200 Subject: [PATCH] Make latest-stamps create intermediate directories (#1500) Fixes #1467 --- instaloader/lateststamps.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instaloader/lateststamps.py b/instaloader/lateststamps.py index 9a67cc2..5846948 100644 --- a/instaloader/lateststamps.py +++ b/instaloader/lateststamps.py @@ -1,6 +1,8 @@ import configparser from datetime import datetime, timezone from typing import Optional +from os.path import dirname +from os import makedirs class LatestStamps: @@ -25,6 +27,7 @@ class LatestStamps: self.data.read(latest_stamps_file) def _save(self): + makedirs(dirname(self.file), exist_ok=True) with open(self.file, 'w') as f: self.data.write(f)