File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -434,12 +434,18 @@ arguments they contain. For example::
434
434
>>> parser.parse_args(['-f', 'foo', '@args.txt'])
435
435
Namespace(f='bar')
436
436
437
- Arguments read from a file must by default be one per line (but see also
437
+ Arguments read from a file must be one per line by default (but see also
438
438
:meth: `~ArgumentParser.convert_arg_line_to_args `) and are treated as if they
439
439
were in the same place as the original file referencing argument on the command
440
440
line. So in the example above, the expression ``['-f', 'foo', '@args.txt'] ``
441
441
is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar'] ``.
442
442
443
+ .. note ::
444
+
445
+ Empty lines are treated as empty strings (``'' ``), which are allowed as values but
446
+ not as arguments. Empty lines that are read as arguments will result in an
447
+ "unrecognized arguments" error.
448
+
443
449
:class: `ArgumentParser ` uses :term: `filesystem encoding and error handler `
444
450
to read the file containing arguments.
445
451
You can’t perform that action at this time.
0 commit comments