Python 3 exception not printing new line

Viewed 3642

I do not really know how to say it, but when I raise exception in python 3.2, '\n' aren't parsed...

Here is an example:

class ParserError(Exception):
    def __init__(self, message):
            super().__init__(self, message)

try:
    raise ParserError("This should have\na line break")
except ParserError as err:
    print(err)

It works like this:

$ ./test.py
(ParserError(...), 'This should have\na line break')

How do I make sure new lines are printed as new lines?

class ParserError(Exception):
    pass

or

print(err.args[1])
2 Answers
Related