Guest User

Untitled

a guest
Nov 19th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #Create this file:
  2. #jupyter notebook --generate-config
  3.  
  4. c.NotebookApp.base_url = '/develop'
  5. c.NotebookApp.ip = '*'
  6. c.NotebookApp.open_browser = False
  7. c.NotebookApp.port = 9999
  8.  
  9. #Generate password:
  10. #In [1]: from notebook.auth import passwd
  11. #In [2]: passwd()
  12. c.NotebookApp.password = 'sha1:XXXXX'
  13.  
  14. import os
  15. from subprocess import check_call
  16.  
  17. def post_save(model, os_path, contents_manager):
  18. """post-save hook for converting notebooks to .py scripts"""
  19. if model['type'] != 'notebook':
  20. return # only do this for notebooks
  21. d, fname = os.path.split(os_path)
  22. check_call(['jupyter', 'nbconvert', '--to', 'script', fname], cwd=d)
  23. #check_call(['jupyter', 'nbconvert', '--to', 'html', fname], cwd=d)
  24.  
  25. c.FileContentsManager.post_save_hook = post_save
Add Comment
Please, Sign In to add comment