Skip to content

Instantly share code, notes, and snippets.

@gajomi
Created January 18, 2014 23:28
Show Gist options
  • Save gajomi/8498230 to your computer and use it in GitHub Desktop.
Save gajomi/8498230 to your computer and use it in GitHub Desktop.
Loading external notebooks
import io
from IPython.nbformat import current
#function for loading external nb
def execute_notebook(nbfile):
with io.open(nbfile) as f:
nb = current.read(f, 'json')
ip = get_ipython()
for cell in nb.worksheets[0].cells:
if cell.cell_type != 'code':
continue
ip.run_cell(cell.input)
#load some notebook (formatted for Dropbox on OSX )
user = !whoami
execute_notebook("/Users/"+user[0]+"/Dropbox/pydslibs/pydslib.ipynb")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment