Skip to content

Commit

Permalink
handle SystemExit
Browse files Browse the repository at this point in the history
  • Loading branch information
mbektas committed Mar 13, 2024
1 parent 717aad9 commit f7035c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion papermill/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ def raise_for_execution_errors(nb, output_path):
"""
error = None
for index, cell in enumerate(nb.cells):
has_sys_exit = False
# check if there is any cell error output
if "outputs" in cell:
for output in cell.outputs:
if output.output_type == "error":
if output.ename == "SystemExit" and (output.evalue == "" or output.evalue == "0"):
has_sys_exit = True
continue
error = PapermillExecutionError(
cell_index=index,
Expand All @@ -213,7 +215,7 @@ def raise_for_execution_errors(nb, output_path):
break

# handle the CellExecutionError exceptions raised that didn't produce a cell error output
if cell.get("metadata", {}).get("papermill", {}).get("exception") == True:
if not has_sys_exit and cell.get("metadata", {}).get("papermill", {}).get("exception") is True:
error = PapermillExecutionError(
cell_index=index,
exec_count=cell.execution_count,
Expand Down

0 comments on commit f7035c0

Please sign in to comment.