diff --git a/papermill/execute.py b/papermill/execute.py index eca6fb1b..7bae3fbf 100644 --- a/papermill/execute.py +++ b/papermill/execute.py @@ -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, @@ -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,