Skip to content

Fix argparse nargs="*" in run_tasks_in_agents_if_exists.py to use REMAINDER for forwarded task args #69

@github-actions

Description

@github-actions

Problem

In scripts/run_tasks_in_agents_if_exists.py at line 58, the extra argument is declared with nargs="*". This means values starting with - (e.g. --fix, -k, --) will be parsed as options by argparse and cause an "unrecognized arguments" error instead of being forwarded to Poe as intended.

File and Location

  • File: scripts/run_tasks_in_agents_if_exists.py
  • Line: 58

Suggested Fix

If this script is intended to pass through arbitrary task args, use argparse.REMAINDER (or parse_known_args) for the forwarded arguments so flags are accepted:

parser.add_argument("extra", nargs=argparse.REMAINDER, ...)

or

args, extra = parser.parse_known_args()

Original Review Comment

extra is declared with nargs="*", so values starting with - (e.g. --fix, -k, --) will be parsed as options and cause an "unrecognized arguments" error instead of being forwarded to Poe. If this script is intended to pass through arbitrary task args, use argparse.REMAINDER (or parse_known_args) for the forwarded arguments so flags are accepted.

References

Generated by PR Review Comment — Create Issue for issue #51

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions