diff --git a/openpnm/phase/_phase.py b/openpnm/phase/_phase.py index 653f19c6c0..803ca37274 100644 --- a/openpnm/phase/_phase.py +++ b/openpnm/phase/_phase.py @@ -95,13 +95,16 @@ def __getitem__(self, key): if element + '.' + prop in self.keys(): vals = super().__getitem__(element + '.' + prop) else: # If above are not triggered then try to interpolate - if self.settings['auto_interpolate']: - if (element == 'pore') and ('throat.'+prop not in self.keys()): + try: + if self.settings['auto_interpolate']: + if (element == 'pore') and ('throat.'+prop not in self.keys()): + raise KeyError(key) + elif (element == 'throat') and ('pore.'+prop not in self.keys()): + raise KeyError(key) + vals = self.interpolate_data(element + '.' + prop) + else: raise KeyError(key) - elif (element == 'throat') and ('pore.'+prop not in self.keys()): - raise KeyError(key) - vals = self.interpolate_data(element + '.' + prop) - else: + except AttributeError: raise KeyError(key) # Finally get locs