Serhiy Storchaka <[email protected]> added the comment:
> It might help if the error message also stated how many arguments were
> actually received, like the TypeError message already does for bad function /
> method calls. E.g.,
>
> "struct.error: pack expected 2 items for packing (got 1)"
Yes, this would be useful. But seldom implemented.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string
>>> '%s %s'%(123,456,789)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during string formatting
struct.pack also inconsistent in other error messages.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: argument for 's' must be a bytes object
>>> struct.pack('i', '123')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: required argument is not an integer
For "s" is mentioned format, and for "i" no. It would be helpful to
mention also the number of the item.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14897>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com