diff --git a/IPython/html/static/notebook/js/outputarea.js b/IPython/html/static/notebook/js/outputarea.js index ecdaf0f..497141d 100644 --- a/IPython/html/static/notebook/js/outputarea.js +++ b/IPython/html/static/notebook/js/outputarea.js @@ -225,10 +225,13 @@ var IPython = (function (IPython) { json.output_type = "pyout"; json.metadata = content.metadata; json.prompt_number = content.execution_count; - } else if (msg_type === "pyerr") { - json.ename = content.ename; - json.evalue = content.evalue; - json.traceback = content.traceback; + } else if (msg_type === "error") { + // pyerr message has been renamed to error, + // but the nbformat has not been updated, + // so transform back to pyerr for json. + json.output_type = "pyerr"; + json = this.convert_mime_types(json, content.data); + json.metadata = this.convert_mime_types({}, content.metadata); } this.append_output(json); }; @@ -285,7 +288,7 @@ var IPython = (function (IPython) { if (json.output_type === 'pyout') { this.append_execute_result(json); } else if (json.output_type === 'pyerr') { - this.append_pyerr(json); + this.append_error(json); } else if (json.output_type === 'stream') { this.append_stream(json); } @@ -425,7 +428,7 @@ var IPython = (function (IPython) { }; - OutputArea.prototype.append_pyerr = function (json) { + OutputArea.prototype.append_error = function (json) { var tb = json.traceback; if (tb !== undefined && tb.length > 0) { var s = ''; diff --git a/IPython/html/static/services/kernels/js/kernel.js b/IPython/html/static/services/kernels/js/kernel.js index dc9c87b..5830331 100644 --- a/IPython/html/static/services/kernels/js/kernel.js +++ b/IPython/html/static/services/kernels/js/kernel.js @@ -76,13 +76,13 @@ var IPython = (function (IPython) { // Initialize the iopub handlers Kernel.prototype.init_iopub_handlers = function () { - var output_types = ['stream', 'display_data', 'execute_result', 'pyerr']; + var output_msg_types = ['stream', 'display_data', 'execute_result', 'error']; this._iopub_handlers = {}; this.register_iopub_handler('status', $.proxy(this._handle_status_message, this)); this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this)); - for (var i=0; i < output_types.length; i++) { - this.register_iopub_handler(output_types[i], $.proxy(this._handle_output_message, this)); + for (var i=0; i < output_msg_types.length; i++) { + this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this)); } }; diff --git a/IPython/kernel/tests/test_message_spec.py b/IPython/kernel/tests/test_message_spec.py index 4859eed..cd28943 100644 --- a/IPython/kernel/tests/test_message_spec.py +++ b/IPython/kernel/tests/test_message_spec.py @@ -165,7 +165,7 @@ class ExecuteInput(Reference): execution_count = Integer() -PyErr = ExecuteReplyError +Error = ExecuteReplyError class Stream(Reference): @@ -202,7 +202,7 @@ references = { 'kernel_info_reply': KernelInfoReply(), 'execute_input' : ExecuteInput(), 'execute_result' : ExecuteResult(), - 'pyerr' : PyErr(), + 'error' : Error(), 'stream' : Stream(), 'display_data' : DisplayData(), 'header' : RHeader(), @@ -276,8 +276,8 @@ def test_execute_error(): nt.assert_equal(reply['status'], 'error') nt.assert_equal(reply['ename'], 'ZeroDivisionError') - pyerr = KC.iopub_channel.get_msg(timeout=TIMEOUT) - validate_message(pyerr, 'pyerr', msg_id) + error = KC.iopub_channel.get_msg(timeout=TIMEOUT) + validate_message(error, 'error', msg_id) def test_execute_inc(): diff --git a/IPython/kernel/zmq/ipkernel.py b/IPython/kernel/zmq/ipkernel.py index 3e5c75b..69b08b0 100755 --- a/IPython/kernel/zmq/ipkernel.py +++ b/IPython/kernel/zmq/ipkernel.py @@ -628,8 +628,8 @@ class Kernel(Configurable): # reset after use shell._reply_content = None - self.session.send(self.iopub_socket, u'pyerr', reply_content, parent=parent, - ident=self._topic('pyerr')) + self.session.send(self.iopub_socket, u'error', reply_content, parent=parent, + ident=self._topic('error')) self.log.info("Exception in apply request:\n%s", '\n'.join(reply_content['traceback'])) result_buf = [] diff --git a/IPython/kernel/zmq/kernelapp.py b/IPython/kernel/zmq/kernelapp.py index ece61e8..24e265b 100644 --- a/IPython/kernel/zmq/kernelapp.py +++ b/IPython/kernel/zmq/kernelapp.py @@ -1,26 +1,19 @@ -"""An Application for launching a kernel -""" +"""An Application for launching a kernel""" + # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- - from __future__ import print_function -# Standard library imports import atexit import os import sys import signal -# System library imports import zmq from zmq.eventloop import ioloop from zmq.eventloop.zmqstream import ZMQStream -# IPython imports from IPython.core.ultratb import FormattedTB from IPython.core.application import ( BaseIPythonApplication, base_flags, base_aliases, catch_config_error @@ -353,7 +346,7 @@ class IPKernelApp(BaseIPythonApplication, InteractiveShellApp, shell = self.shell _showtraceback = shell._showtraceback try: - # replace pyerr-sending traceback with stderr + # replace error-sending traceback with stderr def print_tb(etype, evalue, stb): print ("GUI event loop or pylab initialization failed", file=io.stderr) diff --git a/IPython/kernel/zmq/zmqshell.py b/IPython/kernel/zmq/zmqshell.py index b6fc660..9d80218 100644 --- a/IPython/kernel/zmq/zmqshell.py +++ b/IPython/kernel/zmq/zmqshell.py @@ -510,9 +510,9 @@ class ZMQInteractiveShell(InteractiveShell): # to pick up topic = None if dh.topic: - topic = dh.topic.replace(b'execute_result', b'pyerr') + topic = dh.topic.replace(b'execute_result', b'error') - exc_msg = dh.session.send(dh.pub_socket, u'pyerr', json_clean(exc_content), dh.parent_header, ident=topic) + exc_msg = dh.session.send(dh.pub_socket, u'error', json_clean(exc_content), dh.parent_header, ident=topic) # FIXME - Hack: store exception info in shell object. Right now, the # caller is reading this info after the fact, we need to fix this logic diff --git a/IPython/parallel/client/client.py b/IPython/parallel/client/client.py index 9643708..c57d036 100644 --- a/IPython/parallel/client/client.py +++ b/IPython/parallel/client/client.py @@ -171,7 +171,7 @@ class Metadata(dict): 'execute_input' : None, 'execute_result' : None, - 'pyerr' : None, + 'error' : None, 'stdout' : '', 'stderr' : '', 'outputs' : [], @@ -869,8 +869,8 @@ class Client(HasTraits): name = content['name'] s = md[name] or '' md[name] = s + content['data'] - elif msg_type == 'pyerr': - md.update({'pyerr' : self._unwrap_exception(content)}) + elif msg_type == 'error': + md.update({'error' : self._unwrap_exception(content)}) elif msg_type == 'execute_input': md.update({'execute_input' : content['code']}) elif msg_type == 'display_data': diff --git a/IPython/parallel/controller/hub.py b/IPython/parallel/controller/hub.py index 52dcc9d..0032320 100644 --- a/IPython/parallel/controller/hub.py +++ b/IPython/parallel/controller/hub.py @@ -68,7 +68,7 @@ def empty_record(): 'queue' : None, 'execute_input' : None, 'execute_result': None, - 'pyerr': None, + 'error': None, 'stdout': '', 'stderr': '', } @@ -96,7 +96,7 @@ def init_record(msg): 'queue' : None, 'execute_input' : None, 'execute_result': None, - 'pyerr': None, + 'error': None, 'stdout': '', 'stderr': '', } @@ -865,8 +865,8 @@ class Hub(SessionFactory): s = rec[name] or '' d[name] = s + content['data'] - elif msg_type == 'pyerr': - d['pyerr'] = content + elif msg_type == 'error': + d['error'] = content elif msg_type == 'execute_input': d['execute_input'] = content['code'] elif msg_type in ('display_data', 'execute_result'): @@ -1316,7 +1316,7 @@ class Hub(SessionFactory): def _extract_record(self, rec): """decompose a TaskRecord dict into subsection of reply for get_result""" io_dict = {} - for key in ('execute_input', 'execute_result', 'pyerr', 'stdout', 'stderr'): + for key in ('execute_input', 'execute_result', 'error', 'stdout', 'stderr'): io_dict[key] = rec[key] content = { 'header': rec['header'], diff --git a/IPython/parallel/controller/sqlitedb.py b/IPython/parallel/controller/sqlitedb.py index 777cfe4..eb25b79 100644 --- a/IPython/parallel/controller/sqlitedb.py +++ b/IPython/parallel/controller/sqlitedb.py @@ -122,7 +122,7 @@ class SQLiteDB(BaseDB): 'queue' , 'execute_input' , 'execute_result', - 'pyerr', + 'error', 'stdout', 'stderr', ]) @@ -146,7 +146,7 @@ class SQLiteDB(BaseDB): 'queue' : 'text', 'execute_input' : 'text', 'execute_result' : 'text', - 'pyerr' : 'text', + 'error' : 'text', 'stdout' : 'text', 'stderr' : 'text', }) @@ -257,7 +257,7 @@ class SQLiteDB(BaseDB): queue text, execute_input text, execute_result text, - pyerr text, + error text, stdout text, stderr text) """%self.table) diff --git a/IPython/qt/kernel_mixins.py b/IPython/qt/kernel_mixins.py index e673ec8..9e35c2b 100644 --- a/IPython/qt/kernel_mixins.py +++ b/IPython/qt/kernel_mixins.py @@ -91,8 +91,8 @@ class QtIOPubChannelMixin(ChannelQObject): # Emitted when a message of type 'execute_result' is received. execute_result_received = QtCore.Signal(object) - # Emitted when a message of type 'pyerr' is received. - pyerr_received = QtCore.Signal(object) + # Emitted when a message of type 'error' is received. + error_received = QtCore.Signal(object) # Emitted when a message of type 'display_data' is received display_data_received = QtCore.Signal(object)