##// END OF EJS Templates
Update connect.py...
Update connect.py Fixing a bug on windows 7 32 bit : [IPythonQtConsoleApp] ERROR | Could not setup tunnels Traceback (most recent call last): File "C:\Anaconda\lib\site-packages\IPython\consoleapp.py", line 304, in init_ ssh newports = tunnel_to_kernel(info, self.sshserver, self.sshkey) File "C:\Anaconda\lib\site-packages\IPython\kernel\connect.py", line 364, in t unnel_to_kernel password = getpass("SSH Password for %s: "%sshserver) File "C:\Anaconda\lib\getpass.py", line 95, in win_getpass msvcrt.putch(c) TypeError: must be char, not unicode [IPythonQtConsoleApp] Exiting application: ipython-qtconsole When calling getpass, TypeError: must be char, not unicode

File last commit:

r11130:de5468b5
r12554:52f39dd5
Show More
restarter.py
54 lines | 1.7 KiB | text/x-python | PythonLexer
"""A basic in process kernel monitor with autorestarting.
This watches a kernel's state using KernelManager.is_alive and auto
restarts the kernel if it dies.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from __future__ import absolute_import
from zmq.eventloop import ioloop
from IPython.kernel.restarter import KernelRestarter
from IPython.utils.traitlets import (
Instance,
)
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
class IOLoopKernelRestarter(KernelRestarter):
"""Monitor and autorestart a kernel."""
loop = Instance('zmq.eventloop.ioloop.IOLoop', allow_none=False)
def _loop_default(self):
return ioloop.IOLoop.instance()
_pcallback = None
def start(self):
"""Start the polling of the kernel."""
if self._pcallback is None:
self._pcallback = ioloop.PeriodicCallback(
self.poll, 1000*self.time_to_dead, self.loop
)
self._pcallback.start()
def stop(self):
"""Stop the kernel polling."""
if self._pcallback is not None:
self._pcallback.stop()
self._pcallback = None