Fix rare FileNotFoundError in resumable_iterator()

... that occured when using a path name for the FrozenNodeIterator file
whose dirname was ''.
This commit is contained in:
Alexander Graf 2020-12-02 19:26:27 +01:00
parent ed3fce45da
commit 3530cdc55c

View File

@ -263,6 +263,7 @@ def resumable_iteration(context: InstaloaderContext,
try:
yield is_resuming, start_index
except KeyboardInterrupt:
if os.path.dirname(resume_file_path):
os.makedirs(os.path.dirname(resume_file_path), exist_ok=True)
save(iterator.freeze(), resume_file_path)
context.log("\nSaved resume information to {}.".format(resume_file_path))