The closest I could get is:
In [6]: raise MyError("some message")
MyError Traceback (most recent call last)
<ipython-input-2-4bd48c5b1ce0> in <module>()
MyError: some error message
There is a way to remove the text __main__.before the class name. There is even a way to remove the class name, so the output is as follows:
In [6]: raise MyError("some error message")
Traceback (most recent call last)
<ipython-input-6-4bd48c5b1ce0> in <module>()
: some error message
:. , , .
, :
class MyError(Exception):
__module__ = None
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
self.__class__.__name__ = "CustomTextHere"
:
In [8]: MyError
Out[8]: MyError
In [9]: MyError()
Out[9]: None.CustomTextHere()
In [11]: raise MyError()
CustomTextHere Traceback (most recent call last)
<ipython-input-11-f389ee70e588> in <module>()
CustomTextHere:
In [12]: raise MyError("some error message")
CustomTextHere Traceback (most recent call last)
<ipython-input-12-4bd48c5b1ce0> in <module>()
CustomTextHere: some error message
:, :
self.__class__.__name__ = ""