import uu, traceback print ''.join(traceback.format_exception_only(uu.Error, "text")) raise uu.Error("text")