diff --git a/17-futures/countries/flags.py b/17-futures/countries/flags.py index 7731bc4..d9f5f94 100644 --- a/17-futures/countries/flags.py +++ b/17-futures/countries/flags.py @@ -25,6 +25,8 @@ def save_flag(img, filename): # <5> + if not os.path.exists(DEST_DIR): + os.makedirs(DEST_DIR) path = os.path.join(DEST_DIR, filename) with open(path, 'wb') as fp: fp.write(img) diff --git a/17-futures/countries/flags2_common.py b/17-futures/countries/flags2_common.py index bfa40fb..9586795 100644 --- a/17-futures/countries/flags2_common.py +++ b/17-futures/countries/flags2_common.py @@ -33,6 +33,8 @@ def save_flag(img, filename): + if not os.path.exists(DEST_DIR): + os.makedirs(DEST_DIR) path = os.path.join(DEST_DIR, filename) with open(path, 'wb') as fp: fp.write(img)