Skip to content
Snippets Groups Projects
Commit a1c143d6 authored by Gregory Ashton's avatar Gregory Ashton Committed by Moritz Huebner
Browse files

Improve the warning message when reading a prior-file fails

parent fb475964
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,12 @@ class PriorDict(OrderedDict): ...@@ -115,7 +115,12 @@ class PriorDict(OrderedDict):
elements = line.split('=') elements = line.split('=')
key = elements[0].replace(' ', '') key = elements[0].replace(' ', '')
val = '='.join(elements[1:]) val = '='.join(elements[1:])
prior[key] = eval(val) try:
prior[key] = eval(val)
except TypeError as e:
raise TypeError(
"Unable to parse dictionary file {}, bad line: {} = {}. Error message {}"
.format(filename, key, val, e))
self.update(prior) self.update(prior)
def from_dictionary(self, dictionary): def from_dictionary(self, dictionary):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment