diff --git a/src/uncertainpy/data.py b/src/uncertainpy/data.py index f8b43f8a..84bbfd67 100644 --- a/src/uncertainpy/data.py +++ b/src/uncertainpy/data.py @@ -778,16 +778,25 @@ def append_evaluations(evaluations, group): f = backend.File(filename, "r") if "uncertain parameters" in f.attrs: - self.uncertain_parameters = [parameter.decode("utf8") for parameter in f.attrs["uncertain parameters"]] + try: + self.uncertain_parameters = [parameter.decode("utf8") for parameter in f.attrs["uncertain parameters"]] + except (UnicodeDecodeError, AttributeError): + self.uncertain_parameters = [parameter for parameter in f.attrs["uncertain parameters"]] if "model name" in f.attrs: self.model_name = str(f.attrs["model name"]) if "incomplete results" in f.attrs: - self.incomplete = [incomplete.decode("utf8") for incomplete in f.attrs["incomplete results"]] + try: + self.incomplete = [incomplete.decode("utf8") for incomplete in f.attrs["incomplete results"]] + except (UnicodeDecodeError, AttributeError): + self.incomplete = [incomplete for incomplete in f.attrs["incomplete results"]] if "error" in f.attrs: - self.error = [irregular.decode("utf8") for irregular in f.attrs["error"]] + try: + self.error = [irregular.decode("utf8") for irregular in f.attrs["error"]] + except (UnicodeDecodeError, AttributeError): + self.error = [irregular for irregular in f.attrs["error"]] if "method" in f.attrs: self.method = str(f.attrs["method"])