Commit 4b725c75 authored by Niklaus Hofer's avatar Niklaus Hofer
Browse files

Handle exception if an image has no entry in the json file

parent 9b202500
......@@ -32,7 +32,10 @@ def add_gallery_post(generator):
jsondata=json.load(jsonfile)
for i in os.listdir(articlegallerypath):
if not i.startswith('.') and os.path.isfile(os.path.join(os.path.join(gallerycontentpath, album), i)):
galleryimages[i] = jsondata[i]
try:
galleryimages[i] = jsondata[i]
except KeyError:
galleryimages[i] = {}
else:
print(articlegallerycommentpath)
for i in os.listdir(articlegallerypath):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment