New submission from Steven Bethard <[email protected]>:

What steps will reproduce the problem?

parser = argparse.ArgumentParser()
parser.add_argument('--foo', type=(int, float))

What is the expected output?

ValueError: (<type 'int'>, <type 'float'>) is not callable

What do you see instead?

TypeError: not all arguments converted during string formatting

Please provide any additional information below.

This is caused by calling using the % string formatting operator without
proper wrapping of the argument. The fix is basically:

-            raise ValueError('%r is not callable' % type_func)
+            raise ValueError('%r is not callable' % (type_func,))

----------
components: Library (Lib)
messages: 111316
nosy: bethard
priority: low
severity: normal
stage: needs patch
status: open
title: Calling argparse add_argument with a sequence as 'type' causes spurious 
error message
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9347>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to