New submission from R. David Murray:
Consider the following:
'{run_time:%H:%M:%S},
,COM,DA{id},"{title:.43}",{id},{length:%M:%S}'.format(**mydict)
The error message I got was:
Invalid format specifier
The problem turned out to be that the value of the 'length' key was an integer
instead of a datetime.time(), but it sure wasn't easy to figure out which bit
of the format string or which variable was the problem.
It would be nice for the format error message to include the pattern that it is
parsing when it hits the error. The type of the value being substituted would
also be nice. Perhaps something like:
The format specifier in {length:%HH:%MM} is not valid for type int()
----------
components: Library (Lib)
messages: 210351
nosy: eric.smith, r.david.murray
priority: normal
severity: normal
status: open
title: format error messages should provide context information
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20524>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com