You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you provide -la or --lazy you must provide a True or False otherwise the parser will complain that there's no argument for the flag.
dif.py: error: argument -la/--lazy: expected one argument
Try this instead:
parser.add_argument('-la', '--lazy', help='Compares image dimensions before comparison process.', action='store_true')
The action store_true will store True in the namespace when the flag is provided, it sets required to False, sets the type to bool and sets the default to False
If you want a flag which disables something like rotate you can use the inverse store_false which just inverts the default and const so:
Hi again
FYI, you can improve the argparsing you're doing by using the
action
parameter ofadd_argument
.Example:
If you provide
-la
or--lazy
you must provide aTrue
orFalse
otherwise the parser will complain that there's no argument for the flag.Try this instead:
The action
store_true
will storeTrue
in the namespace when the flag is provided, it sets required toFalse
, sets the type tobool
and sets the default toFalse
If you want a flag which disables something like
rotate
you can use the inversestore_false
which just inverts thedefault
andconst
so:The text was updated successfully, but these errors were encountered: