def log_and_ignore_errors(msg):
 def decorator(fn):
  def decorated_func(*args, **dargs):
   try:
    fn(*args, **dargs)
   except Exception:
    print msg
    traceback.print_exc(file=sys.stdout)
  return decorated_func
 return decorator

def log_and_ignore_errors ( msg ) : def decorator ( fn ) : def decorated_func ( * args , ** dargs ) : try : fn ( * args , ** dargs ) except Exception : print msg traceback . print_exc ( file = sys . stdout ) return decorated_func return decorator
a decorator for wrapping functions in a log exception and ignore try-except block .