New submission from Doug Hellmann <doug.hellm...@gmail.com>:

Most of the argparse type converters handle exceptions with a single line error 
message explaining the problem.  For example, if an argument -i is declared as 
an int, but the value given ('a') cannot be converted to an int, the message is 
something like "argument -i: invalid int value: 'a'".  

On the other hand, FileType raises an IOError, which isn't being caught and 
converted to the simpler error message. Instead, a full traceback is printed.  
To be consistent, the IOError should be trapped and a single error message 
printed.

----------
components: Library (Lib)
files: argparse_filetype_error.py
messages: 112798
nosy: doughellmann
priority: normal
severity: normal
status: open
title: argparse FileType raises ugly exception for missing file
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file18380/argparse_filetype_error.py

_______________________________________
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