MyST-NB icon indicating copy to clipboard operation
MyST-NB copied to clipboard

Cell-level raises-exception tag causes next code-cell to be skipped

Open rossbar opened this issue 3 years ago • 1 comments

Describe the bug

The use of :tags: raises-exception metadata in one cell appears to have prevented the next code cell from executing. The following code-cell does execute though.

To Reproduce

I haven't tested whether this will reproduce the issue, but describes the general setup that is causing the problem I'm seeing.

I expect the following code cell to raise an exception, so I use the raises-exception tag

```{code-cell} ipython3
:tags: [raises-exception]

print(an_unbound_variable)
```

I expect the following cell to run, but I don't see the output of the print statement in the document after execution.

```{code-cell} ipython3
a = 1
print("foo")
```

An (unexpected) exception here, presumably because the previous cell never ran

```{code-cell} ipython3
b = a + 1
```
NameError: name 'a' is not defined.

All subsequent cells appear not to have run.

Expected behavior

The raises-exception metadata tag only affects the cell where it is used, and does not affect the execution of other cells.

Environment

  • Python Version [e.g. 3.7.1]: 3.8.6
  • Package versions or output of jupyter-book --version: myst-nb==0.10.1
  • Operating System: Arch Linux (5.9.1-arch1-1)

Additional context

I do not have this problem if I set the myst-nb config option execution_allow_errors=True. However, I do not want to allow errors in general, just in for this specific cell. If I understand the documentation correctly, the cell-level metadata should not depend on the notebook-wide or project-wide execution configuration options.

rossbar avatar Oct 28 '20 05:10 rossbar

strange, are you still having this issue? It may be an upstream issue with jupyter-client, what version of that do you have installed

chrisjsewell avatar Feb 09 '21 18:02 chrisjsewell