diff --git a/bilby/core/prior.py b/bilby/core/prior.py index 5e6894e740a2c272a7dac7d8c8eac7e1ee1cbaae..aca8e710e1f0fb741ff281e1053a00b2c24253d8 100644 --- a/bilby/core/prior.py +++ b/bilby/core/prior.py @@ -115,7 +115,12 @@ class PriorDict(OrderedDict): elements = line.split('=') key = elements[0].replace(' ', '') 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) def from_dictionary(self, dictionary):