`AttributeError` not handled in `basesections.CompositeSystem`
Quickly fixable
When adding a PureSubstanceComponent
to CompositeSystem.components
, if component.pure_substance.molecular_formula
is missing, the code encounters an attribute error.
The error can be re-created with:
from nomad.client import normalize_all, parse
from nomad.datamodel.metainfo.basesections import PureSubstanceComponent
sample_archive = parse('test.archive.yaml')[0]
sample_archive.data.components.append(PureSubstanceComponent())
normalize_all(sample_archive)
where test.archive.yaml
has following content:
data:
m_def: nomad.datamodel.metainfo.eln.ELNSample
The code block where the error comes from is already inside a try
and checks for ValueError
. Extending this to include AttributeError
can be a quick fix.
Edited by Sarthak Kapoor