[IPython-dev] Zmq Terminal.
Omar Andrés Zapata Mesa
andresete.chaos at gmail.com
Tue May 24 22:00:43 EDT 2011
Hi all.
Thanks Thomas. Sorry by my english!! I am studying and I undertake to
improve.
I am working in implemend Crt+C but I am having a rare problem.
Explain.
I am trying to capture the exception when raw_input is getting the code,
see code
try:
print()
self._splitter.push(raw_input(' In[%i]:
'%self.prompt_count+self.code))
while self._splitter.push_accepts_more():
self.code = raw_input(' .....: '+'
'*self._splitter.indent_spaces)
self._splitter.push('
'*self._splitter.indent_spaces+self.code)
self._execute(self._splitter.source,False)
self._splitter.reset()
except KeyboardInterrupt:
print('\nKeyboardInterrupt\n')
pass
but it produce an error in the ipkernel module
In[1]:
KeyboardInterrupt
In[1]:
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
/home/omazapa/MyProjects/GSoC/ipython/IPython/frontend/zmqterminal/<string>
in <module>()
/home/omazapa/MyProjects/GSoC/ipython/IPython/zmq/ipkernel.pyc in main()
678 shell=kernel.shell)
679
--> 680 start_kernel(namespace, kernel)
681
682
/home/omazapa/MyProjects/GSoC/ipython/IPython/zmq/entry_point.pyc in
start_kernel(namespace=Namespace(colors=None, hb=39548,
ip='127.0.0.1',...ue, pub=34056, pylab=None, req=58834, xrep=59134),
kernel=<IPython.zmq.ipkernel.Kernel object>)
147
148 # Start the kernel mainloop.
--> 149 kernel.start()
150
151
/home/omazapa/MyProjects/GSoC/ipython/IPython/zmq/ipkernel.pyc in
start(self=<IPython.zmq.ipkernel.Kernel object>)
168 """
169 while True:
--> 170 time.sleep(self._poll_interval)
global stdin = undefined
global stdout = undefined
global stderr = undefined
global optional = undefined
global default = undefined
global None = undefined
171 self.do_one_iteration()
172
KeyboardInterrupt:
then the connection is lost.
the idea is capture the exception KeyboardInterrupt in two differents times
1) in raw_input
2) when sub socket is is printing outputs to send signal SIGINT using kernel
manager's method self.km.interrupt_kernel()
The capture of second option is working but the first not for these unkown
error
you can see the code applying the attached diff file to apply in frontend.py
file
I prefer dont push this little change yet to the repo, before get some
opinion.
Very thanks Thomas You're a big help.
--
Omar Andres Zapata Mesa
User Linux #490962
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110524/8759c1f3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: frontend.diff
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110524/8759c1f3/attachment.bin>
More information about the IPython-dev
mailing list