Message127007
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 |
|
Date |
User |
Action |
Args |
2011-01-25 13:43:21 | bethard | set | recipients:
+ bethard, georg.brandl, eric.araujo, doughellmann, SilentGhost, akira, Tarsis.Azevedo |
2011-01-25 13:43:21 | bethard | set | messageid: <1295963001.1.0.873629417052.issue9509@psf.upfronthosting.co.za> |
2011-01-25 13:43:20 | bethard | link | issue9509 messages |
2011-01-25 13:43:20 | bethard | create | |
|