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 iritkatriel
Recipients chris.jerdonek, eric.smith, iritkatriel, jeffknupp, paul.j3
Date 2021-12-10.15:38:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
We could make the error message less wrong:

>>> p.parse_args(['d'])
usage: [-h] {a,b,c}
: error: argument a: invalid choice: 'd' (choose a value in 'abc')

% git diff
diff --git a/Lib/ b/Lib/
index b44fa4f0f6..f03cc1f110 100644
--- a/Lib/
+++ b/Lib/
@@ -2499,8 +2499,8 @@ def _check_value(self, action, value):
         # converted value must be one of the choices (if specified)
         if action.choices is not None and value not in action.choices:
             args = {'value': value,
-                    'choices': ', '.join(map(repr, action.choices))}
-            msg = _('invalid choice: %(value)r (choose from %(choices)s)')
+                    'choices': repr(action.choices)}
+            msg = _('invalid choice: %(value)r (choose a value in %(choices)s)')
             raise ArgumentError(action, msg % args)
     # =======================
Date User Action Args
2021-12-10 15:38:13iritkatrielsetrecipients: + iritkatriel, eric.smith, chris.jerdonek, paul.j3, jeffknupp
2021-12-10 15:38:13iritkatrielsetmessageid: <>
2021-12-10 15:38:13iritkatriellinkissue16977 messages
2021-12-10 15:38:13iritkatrielcreate