Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created April 21, 2020 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/c4d4c43f88f27ea7616af60704a5cf39 to your computer and use it in GitHub Desktop.
Save BMU-Verlag/c4d4c43f88f27ea7616af60704a5cf39 to your computer and use it in GitHub Desktop.
def read_json():
articles = []
try:
with open(ARTICLE_FILE, 'r') as file:
articles = json.load(file)
except FileNotFoundError as e:
print(ARTICLE_FILE, 'does not exist')
except json.decoder.JSONDecodeError as e:
print('Invalid json file:', e.msg, 'in line', e.lineno)
return articles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment