[issue11839] argparse: unexpected behavior of default for FileType('w')
New submission from Paolo Elvati : Hi, when a default is specified for a file argument that is open with writing permission (FileType('w')), the default file is always created even if the argument is specified in the command line. For example he code: import argparse parser = argparse.ArgumentParser() parser.add_argument( "-o", default = 'fake', dest = 'OutputFile', type = argparse.FileType('w') ) args = parser.parse_args() will create the empty file "fake" even if the -o option is given. The value inside the code of args.Outputfile is not affected. Paolo -- components: Library (Lib) messages: 133598 nosy: Paolo.Elvati, bethard priority: normal severity: normal status: open title: argparse: unexpected behavior of default for FileType('w') type: behavior versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue11839> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11839] argparse: unexpected behavior of default for FileType('w')
Changes by Paolo Elvati : -- resolution: -> duplicate status: open -> closed ___ Python tracker <http://bugs.python.org/issue11839> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11839] argparse: unexpected behavior of default for FileType('w')
Changes by Paolo Elvati : -- status: closed -> open ___ Python tracker <http://bugs.python.org/issue11839> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11839] argparse: unexpected behavior of default for FileType('w')
Changes by Paolo Elvati : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue11839> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com