# Exit code 0 with failing C++ notebook

**URL:** <https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789>\
**Category:** ROOT\
**Tags:** jupyter\
**Created:** [August 1, 2020, 10:36pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789 "2020-08-01T22:36:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahesam](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ahesam/32/19455_2.png) [@ahesam](https://root-forum.cern.ch/u/ahesam)\
**Post date:** [August 1, 2020, 10:36pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/1 "2020-08-01T22:36:09Z")

</div>

Hello,

When converting the attached notebook (I cannot upload .ipynb format), I am expecting a non-zero exit code since one of the cells errors out. Unfortunately, the following exits with code 0.

```auto
jupyter convert --execute cpp_reproducer.ipynb

```

On the other hand, running a Python notebook which also contains a failing cell, does in fact return a non-zero exit code.

Could anyone please confirm this to be a bug, and if so have a look for a solution? We are using `jupyter convert` to test our C++ notebooks in a shell script, but currently, any failing notebook goes by undetected. We also use the output html files to upload to our website.

Cheers,  
Ahmad

**cpp\_reproducer.ipynb**

```auto
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[1minput_line_31:1:10: \u001b[0m\u001b[0;1;31mfatal error: \u001b[0m\u001b[1m'non-existing-header' file not found\u001b[0m\n",
      "#include \"non-existing-header\"\n",
      "\u001b[0;1;32m ^ ~~~~~~~~~~~~~~~~~~~~ \n",
      "\u001b[0m"
     ]
    }
   ],
   "source": [
    "#include \"non-existing-header\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ROOT C++",
   "language": "c++",
   "name": "root"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".C",
   "mimetype": " text/x-c++src",
   "name": "c++"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}

```

* * *

_ROOT Version:_ 6.18/04  
_Platform:_ Ubuntu  
_Compiler:_ GCC 9.3

* * *

---

<div class="post-metadata">

**Author:** ![ahesam](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ahesam/32/19455_2.png) [@ahesam](https://root-forum.cern.ch/u/ahesam)\
**Post date:** [August 3, 2020, 11:53am UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/2 "2020-08-03T11:53:00Z")

</div>

@linev, any ideas?

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [August 3, 2020, 12:02pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/3 "2020-08-03T12:02:44Z")

</div>

Hi,

I am not sure that notebook have to return non-zero code in case of failure - there are too many layers in between. But this is rather question for @etejedor

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![ahesam](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ahesam/32/19455_2.png) [@ahesam](https://root-forum.cern.ch/u/ahesam)\
**Post date:** [August 3, 2020, 12:17pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/4 "2020-08-03T12:17:33Z")

</div>

Wasn’t sure either about that, but one of the contributors to the nbconvert project claims that it is part of the spec to return a non-zero exit code when a cell fails: [https://github.com/jupyter/nbconvert/issues/1058](https://github.com/jupyter/nbconvert/issues/1058)

It makes sense to me 😁

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [August 10, 2020, 12:16pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/5 "2020-08-10T12:16:47Z")

</div>

The ROOT C++ kernel is based on metakernel, so it could be an issue in metakernel or a bug in the ROOT C++ kernel itself.

Please open an issue in JIRA:  
[https://sft.its.cern.ch/jira/projects/ROOT](https://sft.its.cern.ch/jira/projects/ROOT)

to follow this up.

---

<div class="post-metadata">

**Author:** ![ahesam](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ahesam/32/19455_2.png) [@ahesam](https://root-forum.cern.ch/u/ahesam)\
**Post date:** [August 10, 2020, 12:54pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/6 "2020-08-10T12:54:47Z")

</div>

OK i made the following bug report: [https://sft.its.cern.ch/jira/browse/ROOT-10977](https://sft.its.cern.ch/jira/browse/ROOT-10977)

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [August 10, 2020, 1:10pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/7 "2020-08-10T13:10:15Z")

</div>

Thank you, much appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [August 24, 2020, 1:10pm UTC](https://root-forum.cern.ch/t/exit-code-0-with-failing-c-notebook/40789/8 "2020-08-24T13:10:20Z")

</div>

Closed on August 24, 2020, 1:10pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
