##// END OF EJS Templates
Properly set prompt numbers
Jessica B. Hamrick -
Show More
@@ -83,17 +83,22 b' class ExecutePreprocessor(Preprocessor):'
83 83 msg = iopub.get_msg(timeout=0.2)
84 84 except Empty:
85 85 break
86
86 87 msg_type = msg['msg_type']
88 content = msg['content']
89 out = NotebookNode(output_type=msg_type)
90
91 # set the prompt number for the input and the output
92 if 'execution_count' in content:
93 cell['prompt_number'] = content['execution_count']
94 out.prompt_number = content['execution_count']
95
87 96 if msg_type in ('status', 'pyin'):
88 97 continue
89 98 elif msg_type == 'clear_output':
90 99 outs = []
91 100 continue
92 101
93 content = msg['content']
94 # print msg_type, content
95 out = NotebookNode(output_type=msg_type)
96
97 102 if msg_type == 'stream':
98 103 out.stream = content['name']
99 104 out.text = content['data']
@@ -104,8 +109,6 b' class ExecutePreprocessor(Preprocessor):'
104 109 # this gets most right, but fix svg+html, plain
105 110 attr = attr.replace('+xml', '').replace('plain', 'text')
106 111 setattr(out, attr, data)
107 if msg_type == 'pyout':
108 out.prompt_number = content['execution_count']
109 112 elif msg_type == 'pyerr':
110 113 out.ename = content['ename']
111 114 out.evalue = content['evalue']
@@ -115,4 +118,3 b' class ExecutePreprocessor(Preprocessor):'
115 118
116 119 outs.append(out)
117 120 return outs
118
General Comments 0
You need to be logged in to leave comments. Login now