##// END OF EJS Templates
Update production code to public names of raw_print functions.
Fernando Perez -
Show More
@@ -70,21 +70,21 b' def make_kernel(namespace, kernel_factory,'
70 )
70 )
71
71
72 # Create a context, a session, and the kernel sockets.
72 # Create a context, a session, and the kernel sockets.
73 io.rprint("Starting the kernel...")
73 io.raw_print("Starting the kernel...")
74 context = zmq.Context()
74 context = zmq.Context()
75 session = Session(username=u'kernel')
75 session = Session(username=u'kernel')
76
76
77 reply_socket = context.socket(zmq.XREP)
77 reply_socket = context.socket(zmq.XREP)
78 xrep_port = bind_port(reply_socket, namespace.ip, namespace.xrep)
78 xrep_port = bind_port(reply_socket, namespace.ip, namespace.xrep)
79 io.rprint("XREP Channel on port", xrep_port)
79 io.raw_print("XREP Channel on port", xrep_port)
80
80
81 pub_socket = context.socket(zmq.PUB)
81 pub_socket = context.socket(zmq.PUB)
82 pub_port = bind_port(pub_socket, namespace.ip, namespace.pub)
82 pub_port = bind_port(pub_socket, namespace.ip, namespace.pub)
83 io.rprint("PUB Channel on port", pub_port)
83 io.raw_print("PUB Channel on port", pub_port)
84
84
85 req_socket = context.socket(zmq.XREQ)
85 req_socket = context.socket(zmq.XREQ)
86 req_port = bind_port(req_socket, namespace.ip, namespace.req)
86 req_port = bind_port(req_socket, namespace.ip, namespace.req)
87 io.rprint("REQ Channel on port", req_port)
87 io.raw_print("REQ Channel on port", req_port)
88
88
89 # Redirect input streams and set a display hook.
89 # Redirect input streams and set a display hook.
90 if out_stream_factory:
90 if out_stream_factory:
@@ -82,11 +82,11 b' class Kernel(Configurable):'
82 # assert self.reply_socket.rcvmore(), "Missing message part."
82 # assert self.reply_socket.rcvmore(), "Missing message part."
83 msg = self.reply_socket.recv_json()
83 msg = self.reply_socket.recv_json()
84 omsg = Message(msg)
84 omsg = Message(msg)
85 io.rprint('\n')
85 io.raw_print('\n')
86 io.rprint(omsg)
86 io.raw_print(omsg)
87 handler = self.handlers.get(omsg.msg_type, None)
87 handler = self.handlers.get(omsg.msg_type, None)
88 if handler is None:
88 if handler is None:
89 io.rprinte("UNKNOWN MESSAGE TYPE:", omsg)
89 io.raw_print_err("UNKNOWN MESSAGE TYPE:", omsg)
90 else:
90 else:
91 handler(ident, omsg)
91 handler(ident, omsg)
92
92
@@ -106,8 +106,8 b' class Kernel(Configurable):'
106 try:
106 try:
107 code = parent[u'content'][u'code']
107 code = parent[u'content'][u'code']
108 except:
108 except:
109 io.rprinte("Got bad msg: ")
109 io.raw_print_err("Got bad msg: ")
110 io.rprinte(Message(parent))
110 io.raw_print_err(Message(parent))
111 return
111 return
112 pyin_msg = self.session.msg(u'pyin',{u'code':code}, parent=parent)
112 pyin_msg = self.session.msg(u'pyin',{u'code':code}, parent=parent)
113 self.pub_socket.send_json(pyin_msg)
113 self.pub_socket.send_json(pyin_msg)
@@ -164,7 +164,7 b' class Kernel(Configurable):'
164
164
165 # Send the reply.
165 # Send the reply.
166 reply_msg = self.session.msg(u'execute_reply', reply_content, parent)
166 reply_msg = self.session.msg(u'execute_reply', reply_content, parent)
167 io.rprint(Message(reply_msg))
167 io.raw_print(Message(reply_msg))
168 self.reply_socket.send(ident, zmq.SNDMORE)
168 self.reply_socket.send(ident, zmq.SNDMORE)
169 self.reply_socket.send_json(reply_msg)
169 self.reply_socket.send_json(reply_msg)
170 if reply_msg['content']['status'] == u'error':
170 if reply_msg['content']['status'] == u'error':
@@ -177,14 +177,14 b' class Kernel(Configurable):'
177 'status' : 'ok'}
177 'status' : 'ok'}
178 completion_msg = self.session.send(self.reply_socket, 'complete_reply',
178 completion_msg = self.session.send(self.reply_socket, 'complete_reply',
179 matches, parent, ident)
179 matches, parent, ident)
180 io.rprint(completion_msg)
180 io.raw_print(completion_msg)
181
181
182 def object_info_request(self, ident, parent):
182 def object_info_request(self, ident, parent):
183 context = parent['content']['oname'].split('.')
183 context = parent['content']['oname'].split('.')
184 object_info = self._object_info(context)
184 object_info = self._object_info(context)
185 msg = self.session.send(self.reply_socket, 'object_info_reply',
185 msg = self.session.send(self.reply_socket, 'object_info_reply',
186 object_info, parent, ident)
186 object_info, parent, ident)
187 io.rprint(msg)
187 io.raw_print(msg)
188
188
189 def prompt_request(self, ident, parent):
189 def prompt_request(self, ident, parent):
190 prompt_number = self.shell.displayhook.prompt_count
190 prompt_number = self.shell.displayhook.prompt_count
@@ -194,7 +194,7 b' class Kernel(Configurable):'
194 'input_sep' : self.shell.displayhook.input_sep}
194 'input_sep' : self.shell.displayhook.input_sep}
195 msg = self.session.send(self.reply_socket, 'prompt_reply',
195 msg = self.session.send(self.reply_socket, 'prompt_reply',
196 content, parent, ident)
196 content, parent, ident)
197 io.rprint(msg)
197 io.raw_print(msg)
198
198
199 def history_request(self, ident, parent):
199 def history_request(self, ident, parent):
200 output = parent['content']['output']
200 output = parent['content']['output']
@@ -204,7 +204,7 b' class Kernel(Configurable):'
204 content = {'history' : hist}
204 content = {'history' : hist}
205 msg = self.session.send(self.reply_socket, 'history_reply',
205 msg = self.session.send(self.reply_socket, 'history_reply',
206 content, parent, ident)
206 content, parent, ident)
207 io.rprint(msg)
207 io.raw_print(msg)
208
208
209 #---------------------------------------------------------------------------
209 #---------------------------------------------------------------------------
210 # Protected interface
210 # Protected interface
@@ -220,11 +220,11 b' class Kernel(Configurable):'
220 else:
220 else:
221 assert self.reply_socket.rcvmore(), "Unexpected missing message part."
221 assert self.reply_socket.rcvmore(), "Unexpected missing message part."
222 msg = self.reply_socket.recv_json()
222 msg = self.reply_socket.recv_json()
223 io.rprint("Aborting:\n", Message(msg))
223 io.raw_print("Aborting:\n", Message(msg))
224 msg_type = msg['msg_type']
224 msg_type = msg['msg_type']
225 reply_type = msg_type.split('_')[0] + '_reply'
225 reply_type = msg_type.split('_')[0] + '_reply'
226 reply_msg = self.session.msg(reply_type, {'status' : 'aborted'}, msg)
226 reply_msg = self.session.msg(reply_type, {'status' : 'aborted'}, msg)
227 io.rprint(Message(reply_msg))
227 io.raw_print(Message(reply_msg))
228 self.reply_socket.send(ident,zmq.SNDMORE)
228 self.reply_socket.send(ident,zmq.SNDMORE)
229 self.reply_socket.send_json(reply_msg)
229 self.reply_socket.send_json(reply_msg)
230 # We need to wait a bit for requests to come in. This can probably
230 # We need to wait a bit for requests to come in. This can probably
@@ -246,8 +246,8 b' class Kernel(Configurable):'
246 try:
246 try:
247 value = reply['content']['value']
247 value = reply['content']['value']
248 except:
248 except:
249 io.rprinte("Got bad raw_input reply: ")
249 io.raw_print_err("Got bad raw_input reply: ")
250 io.rprinte(Message(parent))
250 io.raw_print_err(Message(parent))
251 value = ''
251 value = ''
252 return value
252 return value
253
253
@@ -8,7 +8,6 b' from IPython.core.interactiveshell import ('
8 )
8 )
9 from IPython.core.displayhook import DisplayHook
9 from IPython.core.displayhook import DisplayHook
10 from IPython.core.macro import Macro
10 from IPython.core.macro import Macro
11 from IPython.utils.io import rprint
12 from IPython.utils.path import get_py_filename
11 from IPython.utils.path import get_py_filename
13 from IPython.utils.text import StringTypes
12 from IPython.utils.text import StringTypes
14 from IPython.utils.traitlets import Instance, Type, Dict
13 from IPython.utils.traitlets import Instance, Type, Dict
General Comments 0
You need to be logged in to leave comments. Login now