From f0454930469cb3fb6f59b66f58a11d34c4ca9885 Mon Sep 17 00:00:00 2001 From: Maarten Breddels Date: Fri, 22 Mar 2019 19:21:58 +0100 Subject: [PATCH] fix: work with master of nbconvert (#93) --- voila/execute.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/voila/execute.py b/voila/execute.py index 99619c9bb..f7f90df69 100644 --- a/voila/execute.py +++ b/voila/execute.py @@ -22,8 +22,9 @@ def clear_output(self, outs, msg, cell_index): self.outputs = [] # sync back the state to the kernel self.sync_state() - # sync the state to the nbconvert state as well, since that is used for testing - self.executor.widget_state[self.comm_id]['outputs'] = self.outputs + if hasattr(self.executor, 'widget_state'): + # sync the state to the nbconvert state as well, since that is used for testing + self.executor.widget_state[self.comm_id]['outputs'] = self.outputs def sync_state(self): state = {'outputs': self.outputs} @@ -54,8 +55,9 @@ def output(self, outs, msg, display_id, cell_index): output = {"output_type": "display_data", "data": data, "metadata": {}} self.outputs.append(output) self.sync_state() - # sync the state to the nbconvert state as well, since that is used for testing - self.executor.widget_state[self.comm_id]['outputs'] = self.outputs + if hasattr(self.executor, 'widget_state'): + # sync the state to the nbconvert state as well, since that is used for testing + self.executor.widget_state[self.comm_id]['outputs'] = self.outputs def set_state(self, state): if 'msg_id' in state: