(signal_to_send=None)
Sends the interrupt signal to the remote kernel.  This side steps the
    (non-functional) ipython interrupt mechanisms.
    Only works on posix.
Sends the interrupt signal to the remote kernel.  This side steps the
    (non-functional) ipython interrupt mechanisms.
    Only works on posix.
Sends the interrupt signal to the remote kernel . This side steps the ( non - functional ) ipython interrupt mechanisms . Only works on posix .
def interrupt_kernel_hack(signal_to_send=None):
    """
    Sends the interrupt signal to the remote kernel.  This side steps the
    (non-functional) ipython interrupt mechanisms.
    Only works on posix.
    """
    global pid
    import signal
    import os
    if pid is None:
        # Avoid errors if we couldn't get pid originally,
        # by trying to obtain it now
        pid = set_pid()

        if pid is None:
            echo("cannot get kernel PID, Ctrl-C will not be supported")
            return
    if not signal_to_send:
        signal_to_send = signal.SIGINT

    echo("KeyboardInterrupt (sent to ipython: pid " +
        "%i with signal %s)" % (pid, signal_to_send),"Operator")
    try:
        os.kill(pid, int(signal_to_send))
    except OSError:
        echo("unable to kill pid %d" % pid)
        pid = None
def interrupt_kernel_hack ( signal_to_send = None ) : global pid import signal import os if pid is None : # Avoid errors if we couldn't get pid originally, # by trying to obtain it now pid = set_pid ( ) if pid is None : echo ( "cannot get kernel PID, Ctrl-C will not be supported" ) return if not signal_to_send : signal_to_send = signal . SIGINT echo ( "KeyboardInterrupt (sent to ipython: pid " + "%i with signal %s)" % ( pid , signal_to_send ) , "Operator" ) try : os . kill ( pid , int ( signal_to_send ) ) except OSError : echo ( "unable to kill pid %d" % pid ) pid = None