diff --git a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml
index 66d25000922ebab2311d5b073e42ee7b74b877b3..40acc298332f8414b3f6b88d3baa4a82715b878d 100644
--- a/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml
+++ b/bt5/erp5_data_notebook/SkinTemplateItem/portal_skins/erp5_data_notebook/Base_executeJupyter.xml
@@ -152,9 +152,10 @@ result = {\n
 }\n
 \n
 # Catch exception while seriaizing the result to be passed to jupyter frontend\n
+# and in case of error put code_result as None and status as \'error\' which would\n
+# be shown by Jupyter frontend\n
 try:\n
   serialized_result = json.dumps(result)\n
-  data_notebook_line.edit(notebook_code_result=code_result)\n
 except UnicodeDecodeError:\n
   result = {\n
     u\'code_result\': None,\n
@@ -164,7 +165,9 @@ except UnicodeDecodeError:\n
     u\'status\': u\'error\'\n
   }\n
   serialized_result = json.dumps(result)\n
-  \n
+\n
+data_notebook_line.edit(notebook_code_result=code_result)\n
+\n
 return serialized_result\n
 </string> </value>
         </item>