Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions icecream/icecream.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from contextlib import contextmanager
from os.path import basename, realpath
from textwrap import dedent
import traceback

import colorama
import executing
Expand Down Expand Up @@ -208,8 +209,11 @@ def __init__(self, prefix=DEFAULT_PREFIX,

def __call__(self, *args):
if self.enabled:
callFrame = inspect.currentframe().f_back
self.outputFunction(self._format(callFrame, *args))
try:
callFrame = inspect.currentframe().f_back
self.outputFunction(self._format(callFrame, *args))
except:
print(f"IceCreamDebugger: exception ignored:\n\n{traceback.format_exc()}", sys.stderr)

if not args: # E.g. ic().
passthrough = None
Expand Down