It seems that KeyError
messages are not managed the same way the other errors are.
For example if I want to use colors, it will work for an IndexError
but nor for a KeyError
:
err_message = '\x1b[31m ERROR \x1b[0m'
print err_message
raise IndexError(err_message)
raise KeyError(err_message)
Any idea why?
And is there a way to bypass it?
(I really need a exception of type KeyError
to be raised, to be able to catch it later)