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

(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
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: <>
2011-01-25 13:43:20bethardlinkissue9509 messages
2011-01-25 13:43:20bethardcreate