From 55804c8c1dfa65f4adf9805ed4cfc34ee0939c13 Mon Sep 17 00:00:00 2001 From: JanNeuendorf Date: Fri, 28 Jan 2022 13:19:24 +0100 Subject: [PATCH] check if the tag is a dict --- pyerrors/input/json.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyerrors/input/json.py b/pyerrors/input/json.py index 9704d998..6df1cf67 100644 --- a/pyerrors/input/json.py +++ b/pyerrors/input/json.py @@ -403,13 +403,15 @@ def import_json_string(json_string, verbose=True, full_output=False): if isinstance(o.get('tag'), list): # supports the old way taglist = o.get('tag') # This had to be modified to get the taglist from the dictionary temp_prange = None - else: + elif isinstance(o.get('tag'), dict): tagdic = o.get('tag') taglist = tagdic['tag'] if 'prange' in tagdic: temp_prange = tagdic['prange'] else: temp_prange = None + else: + raise Exception ("The tag is not a list or dict") corr_tag = taglist[-1] tmp_o = o