R. David Murray added the comment: Bytes don't support formatting codes, so they are passed through to object, which doesn't support any formatting codes, and produces the error message you see. Since all other built in types reject invalid codes with a message that mentions their type, I think bytes should too. This would change the message to:
ValueError: Unknown format code 's' for object of type 'bytes' Would that have lessened your confusion sufficiently? ---------- nosy: +eric.smith, r.david.murray stage: -> needs patch title: Non-informative exception while formatting strings. -> Bytes objects should reject all formatting codes with an error message type: -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28385> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com