[issue45673] argparse error with option with optional value

paul j3 report at bugs.python.org
Tue Nov 2 18:25:15 EDT 2021


paul j3 <ajipanca at gmail.com> added the comment:

Put the required positional first

$ myapp myfile -s

or one of the store_true arguments

$ myapp -s -j myfile

I think

$ myapp -s -- myfile

will work as well, but that needs to be tested.  

The '-s' has to be followed by something won't be confused for an argument, such as nothing, or a flag.

----------

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


More information about the Python-bugs-list mailing list