Skip to content

summary_run -h crashes: '-h' parsed as 'patch' positional #711

@cailmdaley

Description

@cailmdaley

Symptom

$ summary_run -h
summary v1.5
Set job info for patch -h

Traceback (most recent call last):
  File "/usr/local/bin/summary_run", line 22, in main
    jobs, list_tile_IDs_dot = set_jobs_v2_pre_v2(patch, verbose)
  File ".../summary_params_pre_v2.py", line 17, in set_jobs_v2_pre_v2
    os.mkdir(path)
FileNotFoundError: [Errno 2] No such file or directory: '/home/.../pre_v2/psfex/-h/summary'

Root cause

summary_run consumes sys.argv[1] as the patch positional without argparse. -h is treated as a patch name, the code then tries to create .../-h/summary/ which fails.

Fix

Adopt argparse (or check sys.argv[1] in {"-h", "--help"} first) in scripts/python/summary_run.py. Minor behavioural change — users who somehow relied on a patch literally named -h would need to pass -- separator, but that's a sane outcome.

Caught by

tests/unit/test_entrypoints.py::test_entrypoint_help[summary_run] (xfailed in #708).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions