import logging try: loop() except SystemExit: raise except MemoryError: raise except Exception: logging.error(exc_info=True)