diff --git a/IPython/zmq/displayhook.py b/IPython/zmq/displayhook.py index 358c979..a3f76ab 100644 --- a/IPython/zmq/displayhook.py +++ b/IPython/zmq/displayhook.py @@ -43,6 +43,7 @@ class ZMQShellDisplayHook(DisplayHook): """A displayhook subclass that publishes data using ZeroMQ. This is intended to work with an InteractiveShell instance. It sends a dict of different representations of the object.""" + topic=None session = Instance(Session) pub_socket = Instance('zmq.Socket') @@ -67,6 +68,6 @@ class ZMQShellDisplayHook(DisplayHook): """Finish up all displayhook activities.""" sys.stdout.flush() sys.stderr.flush() - self.session.send(self.pub_socket, self.msg) + self.session.send(self.pub_socket, self.msg, ident=self.topic) self.msg = None diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 192d4bd..02b81c9 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -145,6 +145,7 @@ class Kernel(Configurable): ) self.shell.displayhook.session = self.session self.shell.displayhook.pub_socket = self.iopub_socket + self.shell.displayhook.topic = self._topic('pyout') self.shell.display_pub.session = self.session self.shell.display_pub.pub_socket = self.iopub_socket diff --git a/IPython/zmq/zmqshell.py b/IPython/zmq/zmqshell.py index d787dcf..222a965 100644 --- a/IPython/zmq/zmqshell.py +++ b/IPython/zmq/zmqshell.py @@ -183,7 +183,11 @@ class ZMQInteractiveShell(InteractiveShell): dh = self.displayhook # Send exception info over pub socket for other clients than the caller # to pick up - exc_msg = dh.session.send(dh.pub_socket, u'pyerr', json_clean(exc_content), dh.parent_header) + topic = None + if dh.topic: + topic = dh.topic.replace(b'pyout', b'pyerr') + + exc_msg = dh.session.send(dh.pub_socket, u'pyerr', 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