Show More
@@ -204,6 +204,7 b' class EngineFactory(RegistrationFactory):' | |||
|
204 | 204 | self.kernel = Kernel(config=self.config, int_id=self.id, ident=self.ident, session=self.session, |
|
205 | 205 | control_stream=control_stream, shell_streams=shell_streams, iopub_socket=iopub_socket, |
|
206 | 206 | loop=loop, user_ns=self.user_ns, log=self.log) |
|
207 | self.kernel.shell.display_pub.topic = cast_bytes('engine.%i.displaypub' % self.id) | |
|
207 | 208 | self.kernel.start() |
|
208 | 209 | |
|
209 | 210 |
@@ -527,16 +527,18 b' class Kernel(Configurable):' | |||
|
527 | 527 | except: |
|
528 | 528 | self.log.error("Got bad msg: %s", parent, exc_info=True) |
|
529 | 529 | return |
|
530 | ||
|
531 | # Set the parent message of the display hook and out streams. | |
|
532 | self.shell.displayhook.set_parent(parent) | |
|
533 | self.shell.display_pub.set_parent(parent) | |
|
534 | sys.stdout.set_parent(parent) | |
|
535 | sys.stderr.set_parent(parent) | |
|
536 | ||
|
530 | 537 | # pyin_msg = self.session.msg(u'pyin',{u'code':code}, parent=parent) |
|
531 | 538 | # self.iopub_socket.send(pyin_msg) |
|
532 | 539 | # self.session.send(self.iopub_socket, u'pyin', {u'code':code},parent=parent) |
|
533 | 540 | sub = self._make_subheader() |
|
534 | 541 | try: |
|
535 | # allow for not overriding displayhook | |
|
536 | if hasattr(sys.displayhook, 'set_parent'): | |
|
537 | sys.displayhook.set_parent(parent) | |
|
538 | sys.stdout.set_parent(parent) | |
|
539 | sys.stderr.set_parent(parent) | |
|
540 | 542 | working = self.shell.user_ns |
|
541 | 543 | |
|
542 | 544 | prefix = "_"+str(msg_id).replace("-","")+"_" |
@@ -43,7 +43,7 b' from IPython.utils import io' | |||
|
43 | 43 | from IPython.utils.jsonutil import json_clean |
|
44 | 44 | from IPython.utils.path import get_py_filename |
|
45 | 45 | from IPython.utils.process import arg_split |
|
46 | from IPython.utils.traitlets import Instance, Type, Dict, CBool | |
|
46 | from IPython.utils.traitlets import Instance, Type, Dict, CBool, CBytes | |
|
47 | 47 | from IPython.utils.warn import warn, error |
|
48 | 48 | from IPython.zmq.displayhook import ZMQShellDisplayHook, _encode_binary |
|
49 | 49 | from IPython.zmq.session import extract_header |
@@ -60,6 +60,7 b' class ZMQDisplayPublisher(DisplayPublisher):' | |||
|
60 | 60 | session = Instance(Session) |
|
61 | 61 | pub_socket = Instance('zmq.Socket') |
|
62 | 62 | parent_header = Dict({}) |
|
63 | topic = CBytes(b'displaypub') | |
|
63 | 64 | |
|
64 | 65 | def set_parent(self, parent): |
|
65 | 66 | """Set the parent for outbound messages.""" |
@@ -82,7 +83,7 b' class ZMQDisplayPublisher(DisplayPublisher):' | |||
|
82 | 83 | content['metadata'] = metadata |
|
83 | 84 | self.session.send( |
|
84 | 85 | self.pub_socket, u'display_data', json_clean(content), |
|
85 | parent=self.parent_header | |
|
86 | parent=self.parent_header, ident=self.topic, | |
|
86 | 87 | ) |
|
87 | 88 | |
|
88 | 89 | def clear_output(self, stdout=True, stderr=True, other=True): |
@@ -97,7 +98,7 b' class ZMQDisplayPublisher(DisplayPublisher):' | |||
|
97 | 98 | |
|
98 | 99 | self.session.send( |
|
99 | 100 | self.pub_socket, u'clear_output', content, |
|
100 | parent=self.parent_header | |
|
101 | parent=self.parent_header, ident=self.topic, | |
|
101 | 102 | ) |
|
102 | 103 | |
|
103 | 104 | class ZMQInteractiveShell(InteractiveShell): |
General Comments 0
You need to be logged in to leave comments.
Login now