[issue36078] argparse: positional with type=int, default=SUPPRESS raise ValueError

Tomáš Jeziorský report at bugs.python.org
Mon Mar 16 10:57:54 EDT 2020


Tomáš Jeziorský <Galileo.Galilei at seznam.cz> added the comment:

I found what appears to be a very similar issue so instead of creating a new issue I will place it here as a comment.

The following code:

==
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('letter', choices=['a', 'b', 'c'], default=argparse.SUPPRESS, nargs='?')
args = parser.parse_args([])
==

results in this error:

==
usage: pok.py [-h] [{a,b,c}]
pok.py: error: argument letter: invalid choice: '==SUPPRESS==' (choose from 'a', 'b', 'c')
==

----------
nosy: +jeyekomon

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36078>
_______________________________________


More information about the Python-bugs-list mailing list