Steven Bethard <steven.beth...@gmail.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9509>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to