diff --git a/CHANGES.rst b/CHANGES.rst index eca599b2..e63fda64 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,8 @@ - Remove bundled ``configobj`` package in favor of the ``configobj`` package bundled into ``astropy``. [#122] - Fix ``datetime.utcnow()`` DeprecationWarning [#134] +- Provide ``asn_n_members=1`` when opening the ``Step`` dataset for + ``get_crds_parameters`` [#142] - Fix bug in handling of ``pathlib.Path`` objects as ``Step`` inputs [#143] 0.5.1 (2023-10-02) diff --git a/src/stpipe/step.py b/src/stpipe/step.py index ca7c8cee..410fa817 100644 --- a/src/stpipe/step.py +++ b/src/stpipe/step.py @@ -841,12 +841,12 @@ def get_config_from_reference(cls, dataset, disable=None, crds_observatory=None) # If the dataset is not an operable instance of AbstractDataModel, # log as such and return an empty config object try: - model = cls._datamodels_open(dataset) - if isinstance(model, Sequence): - # Pull out first model in ModelContainer - model = model[0] - crds_parameters = model.get_crds_parameters() - crds_observatory = model.crds_observatory + with cls._datamodels_open(dataset, asn_n_members=1) as model: + if isinstance(model, Sequence): + # Pull out first model in ModelContainer + model = model[0] + crds_parameters = model.get_crds_parameters() + crds_observatory = model.crds_observatory except (OSError, TypeError, ValueError): logger.warning("Input dataset is not an instance of AbstractDataModel.") disable = True