[issue10523] argparse has problem parsing option files containing empty rows

Caelyn McAulay report at bugs.python.org
Tue Apr 15 17:13:37 CEST 2014


Caelyn McAulay added the comment:

I've attached a patch making the changes I suggested, assuming that the current behaviour is desirable. It documents the behaviour of argparse on files with blank lines and changes the way the error message that argparse generates when encountering unrecognized arguments is generated.

When a blank line is included at the end of a file, the resulting error message is now: "argparse_example.py: error: unrecognized arguments: ''". This also makes it obvious when the problem is white space, e.g. if an argument has trailing spaces, this also makes that obvious.

----------
keywords: +patch
Added file: http://bugs.python.org/file34875/argparse_blanklines.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10523>
_______________________________________


More information about the Python-bugs-list mailing list