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 @@ -415,12 +415,18 @@ arguments they contain. For example::
415
415
>>> parser.parse_args(['-f', 'foo', '@args.txt'])
416
416
Namespace(f='bar')
417
417
418
- Arguments read from a file must by default be one per line (but see also
418
+ Arguments read from a file must be one per line by default (but see also
419
419
:meth: `~ArgumentParser.convert_arg_line_to_args `) and are treated as if they
420
420
were in the same place as the original file referencing argument on the command
421
421
line. So in the example above, the expression ``['-f', 'foo', '@args.txt'] ``
422
422
is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar'] ``.
423
423
424
+ .. note ::
425
+
426
+ Empty lines are treated as empty strings (``'' ``), which are allowed as values but
427
+ not as arguments. Empty lines that are read as arguments will result in an
428
+ "unrecognized arguments" error.
429
+
424
430
:class: `ArgumentParser ` uses :term: `filesystem encoding and error handler `
425
431
to read the file containing arguments.
426
432
You can’t perform that action at this time.
0 commit comments