Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Starting an ipython kernel outside the main thread
import threading
import sys
import signal
# this is the heavy monkey-patching that actually works
# i.e. you can start the kernel fine and connect to it e.g. via
# ipython console --existing
# signal.signal = lambda *args, **kw: None
from IPython.zmq.ipkernel import IPKernelApp
app = IPKernelApp.instance()
def target(app):
_stdout, _stderr = sys.stdout, sys.stderr
try:
# uncomment the next line and you can start the kernel fine
# outside of the main thread although trying to connect to it,
# e.g. via ipython console --existing get you
# ValueError: signal only works in main thread
# app.init_signal = lambda *args, **kw: None
app.initialize()
app.start()
except Exception as e:
sys.stdout, sys.stderr = _stdout, _stderr
import traceback
traceback.print_exc()
t = threading.Thread(target=target, args=(app,))
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.