{"action":"opened","issue":{"url":"https://api.github.com/repos/ipython/ipython/issues/8286","labels_url":"https://api.github.com/repos/ipython/ipython/issues/8286/labels{/name}","comments_url":"https://api.github.com/repos/ipython/ipython/issues/8286/comments","events_url":"https://api.github.com/repos/ipython/ipython/issues/8286/events","html_url":"https://github.com/ipython/ipython/issues/8286","id":67246118,"number":8286,"title":"ExecutePreprocessor should stop and propagate the error","user":{"login":"tritemio","id":4156237,"avatar_url":"https://avatars.githubusercontent.com/u/4156237?v=3","gravatar_id":"","url":"https://api.github.com/users/tritemio","html_url":"https://github.com/tritemio","followers_url":"https://api.github.com/users/tritemio/followers","following_url":"https://api.github.com/users/tritemio/following{/other_user}","gists_url":"https://api.github.com/users/tritemio/gists{/gist_id}","starred_url":"https://api.github.com/users/tritemio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tritemio/subscriptions","organizations_url":"https://api.github.com/users/tritemio/orgs","repos_url":"https://api.github.com/users/tritemio/repos","events_url":"https://api.github.com/users/tritemio/events{/privacy}","received_events_url":"https://api.github.com/users/tritemio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-08T23:53:23Z","updated_at":"2015-04-08T23:53:23Z","closed_at":null,"body":"`ExecutePreprocessor()` does not stop when it encounters an error on the notebook but pass to execute the following cells.\r\n\r\nIdeally `ExecutePreprocessor().preprocess()` should stop the execution on error and propagate the exception raised in the notebook. Runipy with ipython 2.x used to work exactly in this way.\r\n\r\nHere an example to reproduce the issue:\r\n\r\n```\r\nfrom IPython import nbformat\r\nfrom IPython.nbconvert.preprocessors import ExecutePreprocessor\r\n\r\nnb_name = 'notebook_with_error.ipynb'\r\nnb = nbformat.read(nb_name, as_version=4)\r\nep = ExecutePreprocessor(timeout = 3600)\r\nout = ep.preprocess(nb, {'metadata': {'path': nb_name_out}})\r\nnbformat.write(nb, nb_name_out)\r\n```\r\n\r\nI would like to be able to use a scheme like the following to execute notebooks:\r\n\r\n```\r\nnb_name = 'notebook_with_error.ipynb'\r\nnb = nbformat.read(nb_name, as_version=4)\r\nep = ExecutePreprocessor(timeout = 3600)\r\ntry:\r\n    out = ep.preprocess(nb, {'metadata': {'path': nb_name_out}})\r\nexcept Exception as e:\r\n    msg = 'Error executing the notebook \"%s\".\\n\\n' % notebook_name\r\n    print(msg)\r\n    raise e\r\nfinally:\r\n    nbformat.write(nb, nb_name_out)\r\n    display(FileLink(nb_name_out))\r\n```"}}