Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle cell execution error in preprocess_cell() not in run_cell() #120

Merged
merged 4 commits into from
Sep 24, 2015

Conversation

tritemio
Copy link
Contributor

Delay raising CellExecutionError until the cell output is saved.
In this way, when an execution error occurs, the stack trace is stored in
the cell output. Also, CellExecutionError is raised with a message showing
the source of the cell causing the error.

Delay raising CellExecutionError until the cell output is saved.
In this way, when an execution error occurs, the stack trace is stored in 
the cell output. Also, CellExecutionError is raised with a message showing
the source of the cell causing the error.
@minrk
Copy link
Member

minrk commented Sep 24, 2015

Makes sense.

@minrk
Copy link
Member

minrk commented Sep 24, 2015

Can you add a test that verifies the changed behavior? The existing tests are in nbconvert/preprocessors/tests/test_execute.py

@minrk minrk added this to the 4.1 milestone Sep 24, 2015
@tritemio
Copy link
Contributor Author

Sure.

Thinking about it, I didn't change any behaviour. CellExecutionError is still raised in the exact same case. Only the error message is better.

How can I retrieve the content of the error message in the test?

I'm thinking expanding this test.

@tritemio
Copy link
Contributor Author

I reformatted the error message and added a white space removal commit. I can remove if it creates too much noise.

Now the error message includes both the cell source and the error name and message.

(edited to complete paragraph)

@minrk
Copy link
Member

minrk commented Sep 24, 2015

We do generally prefer to avoid things like commits that do nothing but cosmetic changes, so please avoid whitespace commits in the future, but this is fine for now. Thanks!

minrk added a commit that referenced this pull request Sep 24, 2015
Handle cell execution error in preprocess_cell() not in run_cell()
@minrk minrk merged commit a8f4172 into jupyter:master Sep 24, 2015
@tritemio
Copy link
Contributor Author

Thanks for the quick merge!

@malliwi88
Copy link

Hello boys @tritemio @minrk

I have a question, could I use this functionality to prevent an error in a cell interrupt execution of my notebook, from the command line?

I am using the following statement:

jupyter nbconvert --to notebook --ExecutePreprocessor.kernel_name=python2 --ExecutePreprocessor.enabled=True --ExecutePreprocessor.timeout=3000 --execute --inplace in_notebook.ipynb --output=out_notebook.ipynb

What should I add to prevent execution stop for an error in some cell?

Thanks, any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants