New submission from guilherme-pg <guilherme.p.g...@gmail.com>: Trying to set a default value to arguments whose action is "append" causes argparse to raise AttributeError when such arguments are provided in the command line (see attached test case t1.py).
This happens because _AppendAction doesn't expect the presence of a default value for the argument: when the command line is parsed and the argument is found, _AppendAction attempts to append the new value to the list of old values, if any, or the old list. In case there is already a non-list default value, it attempts to append the new value to it, which raises the exception. Is this intended behavior? If so, shouldn't ArgumentError be raised instead? It should also be easy to fix this issue otherwise, making _StoreAction ensure the old values are stored in a list before appending. ---------- components: Library (Lib) files: t1.py messages: 155195 nosy: bethard, guilherme-pg priority: normal severity: normal status: open title: argparse: "append" action fails to override default values type: crash versions: Python 3.3 Added file: http://bugs.python.org/file24761/t1.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14233> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com