0

I am using ipython-autotime with jupyterlab notebook, I am not able to see cell execution time when there is an error in code of cell to be run.

I tried printing pre_run_cell and post_run_cell events and post_run_cell isn't even called when there's an error.

used below script to print the events=>

from datetime import datetime
from IPython import get_ipython

# Custom hook for pre_run_cell
def pre_run_hook(*args, **kwargs):
    print(f"[{datetime.now()}] pre_run_cell called")

# Custom hook for post_run_cell
def post_run_hook(*args, **kwargs):
    print(f"[{datetime.now()}] post_run_cell called")

# Get the current IPython shell (kernel)
ipython = get_ipython()

# Register the hooks
ipython.events.register('pre_run_cell', pre_run_hook)
ipython.events.register('post_run_cell', post_run_hook)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.