When using the arguparse parameter list, if a parameter specifies a default value, it still displays: error: the following arguments are required
Solution:
1. Replace required=True with required=False.
2. Add — before parameter name.
As follows:
parser.add_argument('--mode', '-M', dest='mode', action='store', required=True, choices=['train', 'test'], default='train', help='Mode in which the script is executed.')
Read More:
- RuntimeError: Not implemented on the CPU [How to Solve]
- [Solved] main.py: error: the following arguments are required:
- [Solved] train.py: error: the following arguments are required: –XXXX
- [Solved] TypeError: __init__() missing 1 required positional argument: ‘on_delete’
- [Solved] Error: unrecognized arguments: — no site packages
- [Solved] Python Error: positional argument follows keyword argument
- Python: Panda scramble data
- [solution] pyinnstaller package EXE file tutorial
- How to Fix Errors encountered in executing Python scripts with command line parameters
- python: File Processing and Input and Output
- pytorch model.load_state_dict Error [How to Solve]
- Tensor for argument #2 ‘mat1‘ is on CPU, but expected it to be on GPU (while checking arguments for
- [Solved] Pytorch Download CIFAR1 Datas Error: urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certi
- [Solved] python Error: GuessedAtParserWarning: No parser was explicitly specified
- Pyyaml tutorial introduction to pyyaml library and YML writing and reading
- Python+OpenCV: How to Use Background Subtraction Methods
- Python: How to Processe “return multiple values”
- [zipfile] Python packages files as zip packages & decompresses them
- Python RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
- [Solved] Python Pandas Read Error: OSError: initializing from file failed