[Answered ]-Python, Django: ValueError: unsupported format character '(' (0x28) at index 3

2πŸ‘

βœ…

Check your message catalog entry.

The _(...) call replaces your unicode value with one from the message catalog (if available), and it is that message that throws this exception. Swapping the % and the preceding space would do this, for example:

>>> 'β–Ί% (user)s, random text here @[%(friend_id)s] more random text β—„β—„β—„'.decode('utf-8') % {'user':u'foo', 'friend_id': u'bar'}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unsupported format character '(' (0x28) at index 3

Leave a comment