This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bethard
Recipients SilentGhost, Tarsis.Azevedo, akira, bethard, doughellmann, eric.araujo, georg.brandl
Date 2011-01-25.13:43:20
SpamBayes Score 0.00055487687
Marked as misclassified No
Message-id <1295963001.1.0.873629417052.issue9509@psf.upfronthosting.co.za>
In-reply-to
Content
It's an ArgumentTypeError because that's what you're supposed to raise inside type functions:

http://docs.python.org/dev/library/argparse.html#type

(Note that argparse.FileType.__call__ is what will be called when we pass type=argparse.FileType(...) to add_argument.)

The current docstring for ArgumentTypeError is correct - it says it's "An error from trying to convert a command line string to a type" and we're converting a file path (string) into a file object.  But I certainly wouldn't complain if someone wanted to make the wording there clearer. Basically the rule is:

* Use ArgumentTypeError when you're defining a type= function
* Use ArgumentError otherwise
History
Date User Action Args
2011-01-25 13:43:21bethardsetrecipients: + bethard, georg.brandl, eric.araujo, doughellmann, SilentGhost, akira, Tarsis.Azevedo
2011-01-25 13:43:21bethardsetmessageid: <1295963001.1.0.873629417052.issue9509@psf.upfronthosting.co.za>
2011-01-25 13:43:20bethardlinkissue9509 messages
2011-01-25 13:43:20bethardcreate