python exception message formatting

exception, python

Solution

Your syntax for the %-substitution in `Exception` is incorrect. You need to use `%` to specify the replacement string:

>>> Exception('foo %s' % 'bar').message
'foo bar'

Problem

Question: Why don't I get an exception message when formatting the message with `%s` but I do with `format`? Fails: ``` >>> Exception('foo %s', 'bar').message '' ``` Works: ``` >>> Exception('foo {}'.format('bar')).message 'foo bar' ``` Any explanation why it fails on `%s`?

Original source