How to use IPython notebook with Dropbox

Recently I fell in love with IPython notebook. I installed it on my PC, laptop and my station at work. Very quickly I realized that sometimes I need to access notebook files from work pc at home and vice versa. Since all notebook files are saved locally you have to copy it over to another machine in order to access it.
One way to fix the problem is to setup IPython notebook on remote server and that way all your notebooks are in one place. Another way is to tell your local notebook to look into remote location for files.
Since Dropbox integrates well with Linux by mounting its resource into filesystem it is and ideal service for this purpose. It may be possible to use Google Drive as well but as far as I know it is a little bit more involved.

If you already have Dropbox installed your default Dropbox resource path should be:
/home/username/Dropbox

Follow this steps to change Notebooks default path to Dropbox

Create new container in Dropbox

$ cd /home/username/Dropbox
$ mkdir notebooks

Now we will set IPythons notebooks path as /home/username/Dropbox/notebooks

Locate IPython config files

$ ipython locate
$ /home/username/.config/ipython

Modify config file
In your profile or default profile locate file ipython_notebook_config.py
If you can’t find it try creating a profile:

$ ipython profile create

You should be able to locate config file now:

$ vim ipython_notebook_config.py

and find and modify following variables:

c.NotebookManager.notebook_dir = u'/home/username/Dropbox/notebooks’
c.FileNotebookManager.notebook_dir = u'/home/username/Dropbox/notebooks’

Save the file and next time you start IPython notebook server your new notebooks will be read from Dropbox.

Leave a Reply

Your email address will not be published. Required fields are marked *