Created
January 18, 2014 23:28
-
-
Save gajomi/8498230 to your computer and use it in GitHub Desktop.
Loading external notebooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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