Skip to content

Instantly share code, notes, and snippets.

@gentoo90
Created September 21, 2014 08:23
Show Gist options
  • Save gentoo90/660984417be4db0f913e to your computer and use it in GitHub Desktop.
Save gentoo90/660984417be4db0f913e to your computer and use it in GitHub Desktop.
embed ipython kernel and automatically open console
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
Embed IPython kernel and automatically open console
connected to it.
"""
import os
from zmq.eventloop.ioloop import IOLoop
import IPython
def ip_cb():
app = IPython.config.Application.instance()
os.system('mate-terminal -e "ipython console --existing %s"' % app.connection_file)
loop = IOLoop.instance()
loop.add_callback(ip_cb)
IPython.embed_kernel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment