This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients Pythass, eric.smith, paul.j3
Date 2022-03-13.10:09:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647166153.46.0.686779678467.issue47002@roundup.psfhosted.org>
In-reply-to
Content
Here's a simplified reproducer:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--utc", choices=["-1:00"])
args = parser.parse_args()

I assume this is related to argparse guessing if an argument is a negative number. See https://stackoverflow.com/questions/9025204/python-argparse-issue-with-optional-arguments-which-are-negative-numbers

From a suggestion there, note that
python test.py -u ' -1:00'
doesn't give the "expected one argument" error. I realize that doesn't solve your problem, but it does shed some light on the issue.

I suspect this can't be fixed without breaking other usages of argparse.
History
Date User Action Args
2022-03-13 10:09:13eric.smithsetrecipients: + eric.smith, paul.j3, Pythass
2022-03-13 10:09:13eric.smithsetmessageid: <1647166153.46.0.686779678467.issue47002@roundup.psfhosted.org>
2022-03-13 10:09:13eric.smithlinkissue47002 messages
2022-03-13 10:09:13eric.smithcreate