Any one of these fixes the message, depending on your version of Python.
foo = 'Some more info'
raise MyError("%s: there was an error" % foo )
raise MyError("{}: there was an error".format(foo))
raise MyError(f"{foo}: there was an error")
The message is triggered when pylint
sees the %s
tag in the string with no following arguments. Instead of raising an exception with the string "Some more info: there was an error"
you'll get an exception with a tuple, where the first element is ": there was an error"
and the second is the contents of foo
. This is likely not the intended effect.
In the code I was using, there was extensive use of logging
, and I suspect the original author confused the exception raising with lazy logging.