Show More
@@ -225,10 +225,13 b' var IPython = (function (IPython) {' | |||
|
225 | 225 | json.output_type = "pyout"; |
|
226 | 226 | json.metadata = content.metadata; |
|
227 | 227 | json.prompt_number = content.execution_count; |
|
228 |
} else if (msg_type === " |
|
|
229 | json.ename = content.ename; | |
|
230 | json.evalue = content.evalue; | |
|
231 | json.traceback = content.traceback; | |
|
228 | } else if (msg_type === "error") { | |
|
229 | // pyerr message has been renamed to error, | |
|
230 | // but the nbformat has not been updated, | |
|
231 | // so transform back to pyerr for json. | |
|
232 | json.output_type = "pyerr"; | |
|
233 | json = this.convert_mime_types(json, content.data); | |
|
234 | json.metadata = this.convert_mime_types({}, content.metadata); | |
|
232 | 235 | } |
|
233 | 236 | this.append_output(json); |
|
234 | 237 | }; |
@@ -285,7 +288,7 b' var IPython = (function (IPython) {' | |||
|
285 | 288 | if (json.output_type === 'pyout') { |
|
286 | 289 | this.append_execute_result(json); |
|
287 | 290 | } else if (json.output_type === 'pyerr') { |
|
288 |
this.append_ |
|
|
291 | this.append_error(json); | |
|
289 | 292 | } else if (json.output_type === 'stream') { |
|
290 | 293 | this.append_stream(json); |
|
291 | 294 | } |
@@ -425,7 +428,7 b' var IPython = (function (IPython) {' | |||
|
425 | 428 | }; |
|
426 | 429 | |
|
427 | 430 | |
|
428 |
OutputArea.prototype.append_ |
|
|
431 | OutputArea.prototype.append_error = function (json) { | |
|
429 | 432 | var tb = json.traceback; |
|
430 | 433 | if (tb !== undefined && tb.length > 0) { |
|
431 | 434 | var s = ''; |
@@ -76,13 +76,13 b' var IPython = (function (IPython) {' | |||
|
76 | 76 | // Initialize the iopub handlers |
|
77 | 77 | |
|
78 | 78 | Kernel.prototype.init_iopub_handlers = function () { |
|
79 |
var output_types = ['stream', 'display_data', 'execute_result', ' |
|
|
79 | var output_msg_types = ['stream', 'display_data', 'execute_result', 'error']; | |
|
80 | 80 | this._iopub_handlers = {}; |
|
81 | 81 | this.register_iopub_handler('status', $.proxy(this._handle_status_message, this)); |
|
82 | 82 | this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this)); |
|
83 | 83 | |
|
84 | for (var i=0; i < output_types.length; i++) { | |
|
85 | this.register_iopub_handler(output_types[i], $.proxy(this._handle_output_message, this)); | |
|
84 | for (var i=0; i < output_msg_types.length; i++) { | |
|
85 | this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this)); | |
|
86 | 86 | } |
|
87 | 87 | }; |
|
88 | 88 |
@@ -165,7 +165,7 b' class ExecuteInput(Reference):' | |||
|
165 | 165 | execution_count = Integer() |
|
166 | 166 | |
|
167 | 167 | |
|
168 |
|
|
|
168 | Error = ExecuteReplyError | |
|
169 | 169 | |
|
170 | 170 | |
|
171 | 171 | class Stream(Reference): |
@@ -202,7 +202,7 b' references = {' | |||
|
202 | 202 | 'kernel_info_reply': KernelInfoReply(), |
|
203 | 203 | 'execute_input' : ExecuteInput(), |
|
204 | 204 | 'execute_result' : ExecuteResult(), |
|
205 |
' |
|
|
205 | 'error' : Error(), | |
|
206 | 206 | 'stream' : Stream(), |
|
207 | 207 | 'display_data' : DisplayData(), |
|
208 | 208 | 'header' : RHeader(), |
@@ -276,8 +276,8 b' def test_execute_error():' | |||
|
276 | 276 | nt.assert_equal(reply['status'], 'error') |
|
277 | 277 | nt.assert_equal(reply['ename'], 'ZeroDivisionError') |
|
278 | 278 | |
|
279 |
|
|
|
280 |
validate_message( |
|
|
279 | error = KC.iopub_channel.get_msg(timeout=TIMEOUT) | |
|
280 | validate_message(error, 'error', msg_id) | |
|
281 | 281 | |
|
282 | 282 | |
|
283 | 283 | def test_execute_inc(): |
@@ -628,8 +628,8 b' class Kernel(Configurable):' | |||
|
628 | 628 | # reset after use |
|
629 | 629 | shell._reply_content = None |
|
630 | 630 | |
|
631 |
self.session.send(self.iopub_socket, u' |
|
|
632 |
ident=self._topic(' |
|
|
631 | self.session.send(self.iopub_socket, u'error', reply_content, parent=parent, | |
|
632 | ident=self._topic('error')) | |
|
633 | 633 | self.log.info("Exception in apply request:\n%s", '\n'.join(reply_content['traceback'])) |
|
634 | 634 | result_buf = [] |
|
635 | 635 |
@@ -1,26 +1,19 b'' | |||
|
1 | """An Application for launching a kernel | |
|
2 | """ | |
|
1 | """An Application for launching a kernel""" | |
|
2 | ||
|
3 | 3 | # Copyright (c) IPython Development Team. |
|
4 | 4 | # Distributed under the terms of the Modified BSD License. |
|
5 | 5 | |
|
6 | #----------------------------------------------------------------------------- | |
|
7 | # Imports | |
|
8 | #----------------------------------------------------------------------------- | |
|
9 | ||
|
10 | 6 | from __future__ import print_function |
|
11 | 7 | |
|
12 | # Standard library imports | |
|
13 | 8 | import atexit |
|
14 | 9 | import os |
|
15 | 10 | import sys |
|
16 | 11 | import signal |
|
17 | 12 | |
|
18 | # System library imports | |
|
19 | 13 | import zmq |
|
20 | 14 | from zmq.eventloop import ioloop |
|
21 | 15 | from zmq.eventloop.zmqstream import ZMQStream |
|
22 | 16 | |
|
23 | # IPython imports | |
|
24 | 17 | from IPython.core.ultratb import FormattedTB |
|
25 | 18 | from IPython.core.application import ( |
|
26 | 19 | BaseIPythonApplication, base_flags, base_aliases, catch_config_error |
@@ -353,7 +346,7 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp,' | |||
|
353 | 346 | shell = self.shell |
|
354 | 347 | _showtraceback = shell._showtraceback |
|
355 | 348 | try: |
|
356 |
# replace |
|
|
349 | # replace error-sending traceback with stderr | |
|
357 | 350 | def print_tb(etype, evalue, stb): |
|
358 | 351 | print ("GUI event loop or pylab initialization failed", |
|
359 | 352 | file=io.stderr) |
@@ -510,9 +510,9 b' class ZMQInteractiveShell(InteractiveShell):' | |||
|
510 | 510 | # to pick up |
|
511 | 511 | topic = None |
|
512 | 512 | if dh.topic: |
|
513 |
topic = dh.topic.replace(b'execute_result', b' |
|
|
513 | topic = dh.topic.replace(b'execute_result', b'error') | |
|
514 | 514 | |
|
515 |
exc_msg = dh.session.send(dh.pub_socket, u' |
|
|
515 | exc_msg = dh.session.send(dh.pub_socket, u'error', json_clean(exc_content), dh.parent_header, ident=topic) | |
|
516 | 516 | |
|
517 | 517 | # FIXME - Hack: store exception info in shell object. Right now, the |
|
518 | 518 | # caller is reading this info after the fact, we need to fix this logic |
@@ -171,7 +171,7 b' class Metadata(dict):' | |||
|
171 | 171 | |
|
172 | 172 | 'execute_input' : None, |
|
173 | 173 | 'execute_result' : None, |
|
174 |
' |
|
|
174 | 'error' : None, | |
|
175 | 175 | 'stdout' : '', |
|
176 | 176 | 'stderr' : '', |
|
177 | 177 | 'outputs' : [], |
@@ -869,8 +869,8 b' class Client(HasTraits):' | |||
|
869 | 869 | name = content['name'] |
|
870 | 870 | s = md[name] or '' |
|
871 | 871 | md[name] = s + content['data'] |
|
872 |
elif msg_type == ' |
|
|
873 |
md.update({' |
|
|
872 | elif msg_type == 'error': | |
|
873 | md.update({'error' : self._unwrap_exception(content)}) | |
|
874 | 874 | elif msg_type == 'execute_input': |
|
875 | 875 | md.update({'execute_input' : content['code']}) |
|
876 | 876 | elif msg_type == 'display_data': |
@@ -68,7 +68,7 b' def empty_record():' | |||
|
68 | 68 | 'queue' : None, |
|
69 | 69 | 'execute_input' : None, |
|
70 | 70 | 'execute_result': None, |
|
71 |
' |
|
|
71 | 'error': None, | |
|
72 | 72 | 'stdout': '', |
|
73 | 73 | 'stderr': '', |
|
74 | 74 | } |
@@ -96,7 +96,7 b' def init_record(msg):' | |||
|
96 | 96 | 'queue' : None, |
|
97 | 97 | 'execute_input' : None, |
|
98 | 98 | 'execute_result': None, |
|
99 |
' |
|
|
99 | 'error': None, | |
|
100 | 100 | 'stdout': '', |
|
101 | 101 | 'stderr': '', |
|
102 | 102 | } |
@@ -865,8 +865,8 b' class Hub(SessionFactory):' | |||
|
865 | 865 | s = rec[name] or '' |
|
866 | 866 | d[name] = s + content['data'] |
|
867 | 867 | |
|
868 |
elif msg_type == ' |
|
|
869 |
d[' |
|
|
868 | elif msg_type == 'error': | |
|
869 | d['error'] = content | |
|
870 | 870 | elif msg_type == 'execute_input': |
|
871 | 871 | d['execute_input'] = content['code'] |
|
872 | 872 | elif msg_type in ('display_data', 'execute_result'): |
@@ -1316,7 +1316,7 b' class Hub(SessionFactory):' | |||
|
1316 | 1316 | def _extract_record(self, rec): |
|
1317 | 1317 | """decompose a TaskRecord dict into subsection of reply for get_result""" |
|
1318 | 1318 | io_dict = {} |
|
1319 |
for key in ('execute_input', 'execute_result', ' |
|
|
1319 | for key in ('execute_input', 'execute_result', 'error', 'stdout', 'stderr'): | |
|
1320 | 1320 | io_dict[key] = rec[key] |
|
1321 | 1321 | content = { |
|
1322 | 1322 | 'header': rec['header'], |
@@ -122,7 +122,7 b' class SQLiteDB(BaseDB):' | |||
|
122 | 122 | 'queue' , |
|
123 | 123 | 'execute_input' , |
|
124 | 124 | 'execute_result', |
|
125 |
' |
|
|
125 | 'error', | |
|
126 | 126 | 'stdout', |
|
127 | 127 | 'stderr', |
|
128 | 128 | ]) |
@@ -146,7 +146,7 b' class SQLiteDB(BaseDB):' | |||
|
146 | 146 | 'queue' : 'text', |
|
147 | 147 | 'execute_input' : 'text', |
|
148 | 148 | 'execute_result' : 'text', |
|
149 |
' |
|
|
149 | 'error' : 'text', | |
|
150 | 150 | 'stdout' : 'text', |
|
151 | 151 | 'stderr' : 'text', |
|
152 | 152 | }) |
@@ -257,7 +257,7 b' class SQLiteDB(BaseDB):' | |||
|
257 | 257 | queue text, |
|
258 | 258 | execute_input text, |
|
259 | 259 | execute_result text, |
|
260 |
|
|
|
260 | error text, | |
|
261 | 261 | stdout text, |
|
262 | 262 | stderr text) |
|
263 | 263 | """%self.table) |
@@ -91,8 +91,8 b' class QtIOPubChannelMixin(ChannelQObject):' | |||
|
91 | 91 | # Emitted when a message of type 'execute_result' is received. |
|
92 | 92 | execute_result_received = QtCore.Signal(object) |
|
93 | 93 | |
|
94 |
# Emitted when a message of type ' |
|
|
95 |
|
|
|
94 | # Emitted when a message of type 'error' is received. | |
|
95 | error_received = QtCore.Signal(object) | |
|
96 | 96 | |
|
97 | 97 | # Emitted when a message of type 'display_data' is received |
|
98 | 98 | display_data_received = QtCore.Signal(object) |
General Comments 0
You need to be logged in to leave comments.
Login now