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