Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MosaicPipeline fails with UnboundLocalError when provided a ModelLibrary #1643

Open
braingram opened this issue Feb 25, 2025 · 0 comments · May be fixed by #1642
Open

MosaicPipeline fails with UnboundLocalError when provided a ModelLibrary #1643

braingram opened this issue Feb 25, 2025 · 0 comments · May be fixed by #1642

Comments

@braingram
Copy link
Collaborator

braingram commented Feb 25, 2025

from romancal.pipeline import MosaicPipeline
from romancal.datamodels import ModelLibrary

lib = ModelLibrary("L3_mosaic_asn.json")  # from regtest files
p = MosaicPipeline()
p(lib)

produces an exception:

File ~/.pyenv/versions/3.12.4/envs/romancal/lib/python3.12/site-packages/stpipe/step.py:585, in Step.__call__(self, *args)
    579 def __call__(self, *args):
    580     warnings.warn(
    581         "Step.__call__ is deprecated. It is equivalent to Step.run "
    582         "and is not recommended.",
    583         UserWarning,
    584     )
--> 585     return self.run(*args)

File ~/.pyenv/versions/3.12.4/envs/romancal/lib/python3.12/site-packages/stpipe/step.py:507, in Step.run(self, *args)
    505     self.prefetch(*args)
    506 try:
--> 507     step_result = self.process(*args)
    508 except TypeError as e:
    509     if "process() takes exactly" in str(e):

File ~/projects/src/romancal/romancal/pipeline/mosaic_pipeline.py:166, in MosaicPipeline.process(self, input)
    163         if input_filename:
    164             result.meta.filename = self.output_file
--> 166 return result

UnboundLocalError: cannot access local variable 'result' where it is not associated with a value

Due to the mosaic pipeline failing to handle all possible returns for filetype. Providing a DataModel causes the same error for the same reason.

@braingram braingram linked a pull request Feb 25, 2025 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant