def dump_json(data, file): try: with open(file, 'w') as datafile: json.dump(data, datafile) except Exception as e: raise e