diff --git a/district/jekyll_import.py b/district/jekyll_import.py index 504c315ebb0e20100e4064525ee9cfd255a1f276..755483c8c9fed75ea5a405d13c4c6059786c638b 100644 --- a/district/jekyll_import.py +++ b/district/jekyll_import.py @@ -118,7 +118,7 @@ def import_post(path, file_path, parent, title_suffix, dry_run, repo_name): r = re.split(r"^---\s*$", f.read(), maxsplit=3, flags=re.MULTILINE) try: meta = yaml.safe_load(r[1]) - except ScannerError: + except (ScannerError, ValueError): message_list.append( {"level": ERROR, "text": "Nevalidní yaml pro {}".format(path)} ) @@ -229,7 +229,7 @@ def get_or_create_image(path, file_path, collection, repo_name) -> Image or None img_path = os.path.join(path, img_name) try: urllib.request.urlretrieve(img_url, img_path) - except (HTTPError, UnicodeEncodeError, InvalidURL): + except (HTTPError, UnicodeEncodeError, InvalidURL, IsADirectoryError): message_list.append( { "level": WARNING,