Skip to content

Commit

Permalink
Fix species test
Browse files Browse the repository at this point in the history
  • Loading branch information
sivonxay committed Jan 6, 2024
1 parent 5867e5f commit ac80d60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/NanoParticleTools/species_data/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,16 @@ def species_data(self) -> dict[str, tuple[list[str], list[float]]]:
with open(os.path.join(SPECIES_DATA_PATH, f'{symbol}.json'),
'r') as f:
species_data = json.load(f)
except FileNotFoundError:
except FileNotFoundError as e:
# File was not found, check if it is a legacy calc
if self.symbol in self.LEGACY_SURFACE_NAMES:
# This is a legacy calc. Load the corresponding calc
symbol = self.LEGACY_SURFACE_NAMES[self.symbol]
with open(os.path.join(SPECIES_DATA_PATH, f'{symbol}.json'),
'r') as f:
species_data = json.load(f)
else:
raise e

return species_data

Expand Down

0 comments on commit ac80d60

Please sign in to comment.