##// END OF EJS Templates
raw_input captured and working fine
Omar Andres Zapata Mesa -
Show More
@@ -27,6 +27,7 b' import cPickle as pickle'
27 27 import code
28 28 import zmq
29 29 import rlcompleter
30 import readline
30 31 import time
31 32
32 33
@@ -70,9 +71,9 b' class Frontend(object):'
70 71 self.msg_header = self.km.session.msg_header()
71 72
72 73 self.completer = completer.ClientCompleter(self,self.session,self.request_socket)
73 rlcompleter.readline.set_completer(self.completer.complete)
74 rlcompleter.readline.parse_and_bind("tab: complete")
75 rlcompleter.readline.parse_and_bind('set show-all-if-ambiguous on')
74 readline.set_completer(self.completer.complete)
75 readline.parse_and_bind("tab: complete")
76 readline.parse_and_bind('set show-all-if-ambiguous on')
76 77
77 78 history_path = os.path.expanduser('~/.ipython/history')
78 79 if os.path.isfile(history_path):
@@ -134,12 +135,14 b' class Frontend(object):'
134 135 """
135 136 self.km.xreq_channel.execute(source, hidden)
136 137 self.handle_xreq_channel()
138 self.handle_rep_channel()
137 139
138 140 def handle_xreq_channel(self):
139 141 # Give the kernel up to 0.5s to respond
140 142 for i in range(5):
141 143 if self.km.xreq_channel.was_called():
142 144 self.msg_xreq = self.km.xreq_channel.get_msg()
145 #print self.msg_xreq
143 146 if self.msg_header["session"] == self.msg_xreq["parent_header"]["session"] :
144 147 if self.msg_xreq["content"]["status"] == 'ok' :
145 148 if self.msg_xreq["msg_type"] == "complete_reply" :
@@ -186,9 +189,20 b' class Frontend(object):'
186 189
187 190 if sub_msg['msg_type'] == 'pyout' :
188 191 print >> sys.stdout,"Out[%i]:"%sub_msg["content"]["execution_count"], sub_msg["content"]["data"]
189 #print >> sys.stdout,"Out[%i]:"%self.msg_xreq["content"]["execution_count"], sub_msg["content"]["data"]
190 192 sys.stdout.flush()
191 193
194 def handle_rep_channel(self):
195 """ Method to capture raw_input
196 """
197 if self.km.rep_channel.was_called() :
198 self.msg_rep = self.km.rep_channel.get_msg()
199 #print self.msg_rep
200 if self.msg_header["session"] == self.msg_rep["parent_header"]["session"] :
201 raw_data = raw_input(self.msg_rep["content"]["prompt"])
202 self.km.rep_channel.input(raw_data)
203
204
205
192 206
193 207 def start_frontend():
194 208 """ Entry point for application.
General Comments 0
You need to be logged in to leave comments. Login now